llvm-project/flang/test/Lower
Jean Perier 5bc9ee1b78 [flang][lowering] Handle zero extent case in LBOUND
Follow up of https://reviews.llvm.org/D121488. Ensure lower bounds
are `1` when the related dimension extent is zero. Note that lower
bounds from descriptors are now guaranteed to fulfill this property
after the runtime/codegen patches.

Also fixes explicit shape array extent lowering when instantiating
variables to deal with negative extent cases (issue found while testing
LBOUND edge case). This notably caused allocation crashes when dealing
with automatic arrays with reversed bounds or negative size
specification expression. The standard specifies that the extent of such
arrays is zero. This change has some ripple effect in the current lit
tests.

Add move two helpers as part of this change:
- Add a helper to tell if a fir::ExtendedValue describes an assumed size
  array (last dimension extent is unknown to the compiler, both at compile
  time and runtime).

- Move and share getIntIfConstant from Character.cpp so that it can be
  used elsewhere (NFC).

Differential Revision: https://reviews.llvm.org/D122467
2022-03-25 18:05:54 +01:00
..
Intrinsics [Flang] Lower achar intrinsic 2022-03-25 14:23:32 +00:00
OpenACC [flang[OpenACC] Lower wait directive 2022-03-24 17:15:27 +01:00
OpenMP [flang][OpenMP] Added lowering support for sections construct 2022-03-24 13:29:38 +05:30
forall [flang][lowering] Handle zero extent case in LBOUND 2022-03-25 18:05:54 +01:00
allocatable-assignment.f90 [flang] Lower boxed procedure 2022-03-22 15:41:11 +01:00
allocatable-callee.f90 [flang] Lower boxed procedure 2022-03-22 15:41:11 +01:00
allocatable-caller.f90 [flang] Add test for allocatable on the caller side 2022-03-01 23:26:43 +01:00
allocatable-globals.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
allocatable-runtime.f90 [flang] Lower boxed procedure 2022-03-22 15:41:11 +01:00
allocatables.f90 [flang] Lower boxed procedure 2022-03-22 15:41:11 +01:00
allocated.f90 [flang] Lower allocated intrinsic 2022-03-15 22:13:07 +01:00
alternate-return.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
arguments.f90 [flang] Handle allocatable dummy arguments 2022-02-24 17:16:55 +01:00
arithmetic-goto.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
array-character.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
array-constructor-1.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
array-constructor-2.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
array-elemental-calls-2.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
array-elemental-calls.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
array-expression-slice-2.f90 [flang][NFC] Add lowering test for array expression 2022-03-24 14:59:33 +01:00
array-expression-subscript.f90 [flang][NFC] Add lowering test for array expression 2022-03-24 14:59:33 +01:00
array-expression.f90 [flang][lowering] Handle zero extent case in LBOUND 2022-03-25 18:05:54 +01:00
assigned-goto.f90 [flang] Lower computed and assigned goto 2022-03-08 20:19:18 +01:00
assignment.f90 [flang] Simple array assignment lowering 2022-02-24 21:23:30 +01:00
associate-construct-2.f90 [flang][NFC] Add misc lowering tests 2022-03-23 15:24:40 +01:00
associate-construct.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
assumed-shape-callee.f90 [flang][NFC] Add misc lowering tests 2022-03-23 15:24:40 +01:00
assumed-shape-caller.f90 [flang][NFC] Add misc lowering tests 2022-03-23 15:24:40 +01:00
attributes.f90 [flang][NFC] Add misc lowering tests 2022-03-23 15:24:40 +01:00
basic-call.f90 [flang] Lower function and subroutine calls 2022-02-23 19:50:06 +01:00
basic-function.f90 [flang] Lower simple character return 2022-02-25 18:23:13 +01:00
basic-program.f90 [flang] Initial lowering for empty program 2022-01-28 22:39:58 +01:00
basic-subroutine.f90 [flang] Add lowering for basic empty SUBROUTINE 2022-02-01 15:28:18 +01:00
c-interoperability.f90 [flang] Add lowering C interoperability test 2022-03-23 15:23:34 +01:00
call-by-value-attr.f90 [flang][NFC] Add call lowering tests 2022-03-23 15:27:17 +01:00
call-by-value.f90 [flang][NFC] Add call lowering tests 2022-03-23 15:27:17 +01:00
call-copy-in-out.f90 [flang][NFC] Add call lowering tests 2022-03-23 15:27:17 +01:00
call-implicit.f90 [flang][NFC] Add call lowering tests 2022-03-23 15:27:17 +01:00
call-parenthesized-arg.f90 [flang][lowering] Handle zero extent case in LBOUND 2022-03-25 18:05:54 +01:00
call-site-mangling.f90 [flang][NFC] Add call lowering tests 2022-03-23 15:27:17 +01:00
call-suspect.f90 [flang][NFC] Add call lowering tests 2022-03-23 15:27:17 +01:00
call.f90 [flang][NFC] Add call lowering tests 2022-03-23 15:27:17 +01:00
character-assignment.f90 [flang][NFC] Add character lowering tests 2022-03-23 15:28:29 +01:00
character-compare.f90 [flang][NFC] Add character lowering tests 2022-03-23 15:28:29 +01:00
character-concatenation.f90 [flang][NFC] Add character lowering tests 2022-03-23 15:28:29 +01:00
character-elemental.f90 [flang][NFC] Add character lowering tests 2022-03-23 15:28:29 +01:00
character-local-variables.f90 [flang][lowering] Handle zero extent case in LBOUND 2022-03-25 18:05:54 +01:00
character-substrings.f90 [flang][NFC] Add character lowering tests 2022-03-23 15:28:29 +01:00
common-block.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
complex-operations.f90 [flang][NFC] Add complex operations lowering tests 2022-02-28 21:37:34 +01:00
complex-part.f90 [flang][NFC] Add more lowering tests 2022-03-24 00:09:06 +01:00
computed-goto.f90 [flang][NFC] Add more lowering tests 2022-03-24 00:09:06 +01:00
control-flow.f90 [flang][NFC] Add more lowering tests 2022-03-24 00:09:06 +01:00
default-initialization-globals.f90 [flang][NFC] Add global lowering tests 2022-03-23 17:02:15 +01:00
default-initialization.f90 [flang][NFC] Add more lowering tests 2022-03-24 00:09:06 +01:00
dense-attributed-array.f90 [flang][NFC] Add more lowering tests 2022-03-24 00:09:06 +01:00
derived-allocatable-components.f90 [flang][NFC] Add derived type lowering tests 2022-03-23 23:00:02 +01:00
derived-assignments.f90 [flang][NFC] Add derived type lowering tests 2022-03-23 23:00:02 +01:00
derived-pointer-components.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
derived-type-descriptor.f90 [flang][NFC] Add derived type lowering tests 2022-03-23 23:00:02 +01:00
derived-types-kind-params.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
derived-types.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
dummy-argument-contiguous.f90 [flang] Add more lowering tests for dummy arguments 2022-03-17 17:14:57 +01:00
dummy-argument-optional-2.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
dummy-argument-optional.f90 [flang] Add more lowering tests for dummy arguments 2022-03-17 17:14:57 +01:00
dummy-arguments.f90 [flang] Add more lowering tests for dummy arguments 2022-03-17 17:14:57 +01:00
dummy-procedure-character.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
dummy-procedure.f90 [flang] Lower boxed procedure 2022-03-22 15:41:11 +01:00
entry-statement.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
equivalence-1.f90 [flang] Add equivalence lowering tests 2022-03-17 17:16:19 +01:00
equivalence-2.f90 [flang] Add equivalence lowering tests 2022-03-17 17:16:19 +01:00
equivalence-static-init.f90 [flang] Add equivalence lowering tests 2022-03-17 17:16:19 +01:00
explicit-interface-results-2.f90 [flang][NFC] Add lowering tests for interfaces 2022-03-23 23:02:44 +01:00
explicit-interface-results.f90 [flang][NFC] Add lowering tests for interfaces 2022-03-23 23:02:44 +01:00
format-statement.f90 [flang] Lower format statement 2022-03-14 18:15:32 +01:00
global-format-strings.f90 [flang][NFC] Add global lowering tests 2022-03-23 17:02:15 +01:00
global-initialization.f90 [flang][NFC] Add global lowering tests 2022-03-23 17:02:15 +01:00
goto-statement.f90 [Flang] Add support for lowering the goto statement 2022-02-09 09:48:13 +00:00
host-associated.f90 [flang] Lower boxed procedure 2022-03-22 15:41:11 +01:00
identical-block-merge-disable.f90 [flang][NFC] Add more lowering tests 2022-03-24 00:09:06 +01:00
implicit-interface.f90 [flang][NFC] Add lowering tests for interfaces 2022-03-23 23:02:44 +01:00
integer-operations.f90 [flang] Lower integer comparison operation 2022-02-25 21:01:27 +01:00
io-item-list.f90 [flang][NFC] Add IO related lowering tests 2022-03-23 16:54:03 +01:00
io-statement-1.f90 [flang] Lower inquire statement 2022-03-02 18:03:29 +01:00
io-statement-2.f90 [flang] Handle dynamic array lowering 2022-03-01 22:29:49 +01:00
io-statement-3.f90 [flang] Add IO lowering test 2022-03-17 17:00:13 +01:00
io-statement-clean-ups.f90 [flang][NFC] Add IO related lowering tests 2022-03-23 16:54:03 +01:00
llvm-math.f90 [Flang] Lower sin, cos intrinsics 2022-03-23 15:20:51 +00:00
logical-as-fortran.f90 [flang][NFC] Add more lowering tests 2022-03-24 00:09:06 +01:00
logical-operations.f90 [flang] Lower logical comparison and logical operations 2022-02-25 21:05:44 +01:00
module-and-internal-proc.f90 [flang][NFC] Add module lowering tests 2022-03-23 17:51:09 +01:00
module-single-point-of-def.f90 [flang][NFC] Add module lowering tests 2022-03-23 17:51:09 +01:00
module_definition.f90 [flang][NFC] Add module lowering tests 2022-03-23 17:51:09 +01:00
module_use.f90 [flang][NFC] Add module lowering tests 2022-03-23 17:51:09 +01:00
module_use_in_same_file.f90 [flang][NFC] Add module lowering tests 2022-03-23 17:51:09 +01:00
namelist.f90 [flang][NFC] Add namelist lowering test 2022-03-23 16:52:44 +01:00
nested-where.f90 [flang][NFC] Add nested where lowering test 2022-03-23 17:04:18 +01:00
nullify.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
pause-statement.f90 [flang] Lower PAUSE statement 2022-02-02 08:16:12 +01:00
pointer-args-caller.f90 [flang][NFC] Add pointer dummy arguments tests 2022-03-22 20:57:15 +01:00
pointer-assignments.f90 [flang][NFC] Add pointer dummy arguments tests 2022-03-22 20:57:15 +01:00
pointer-disassociate.f90 [flang][NFC] Add pointer dummy arguments tests 2022-03-22 20:57:15 +01:00
pointer-initial-target-2.f90 [flang][NFC] Add pointer dummy arguments tests 2022-03-22 20:57:15 +01:00
pointer-initial-target.f90 [flang][NFC] Add pointer dummy arguments tests 2022-03-22 20:57:15 +01:00
pointer-references.f90 [flang][NFC] Add pointer dummy arguments tests 2022-03-22 20:57:15 +01:00
pointer-results-as-arguments.f90 [flang][NFC] Add pointer dummy arguments tests 2022-03-22 20:57:15 +01:00
pointer-runtime.f90 [flang][NFC] Add pointer dummy arguments tests 2022-03-22 20:57:15 +01:00
pointer.f90 [flang][NFC] Add pointer dummy arguments tests 2022-03-22 20:57:15 +01:00
power-operator.f90 [flang] Lower power operations 2022-02-28 14:49:14 +01:00
pre-fir-tree01.f90 [flang] Update PFTBuilder 2022-02-22 19:09:28 +01:00
pre-fir-tree02.f90 [flang] Update PFTBuilder 2022-02-22 19:09:28 +01:00
pre-fir-tree03.f90 [flang] Make the frontend driver error out when requesting multiple actions 2021-12-17 10:05:28 +00:00
pre-fir-tree04.f90 [flang] Make the frontend driver error out when requesting multiple actions 2021-12-17 10:05:28 +00:00
pre-fir-tree05.f90 [flang] Update PFTBuilder 2022-02-22 19:09:28 +01:00
pre-fir-tree06.f90 [flang] Fix processing ModuleLikeUnit evaluationList 2022-03-11 15:20:23 +08:00
pre-fir-tree07.f90 [flang] Support for dump OpenMP/OpenACC declarative directives PFT in module 2022-03-11 14:33:17 +08:00
procedure-declarations.f90 [flang] Lower boxed procedure 2022-03-22 15:41:11 +01:00
program-units-fir-mangling.f90 [flang] Lower procedure designator 2022-03-21 18:05:18 +01:00
read-write-buffer.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
real-operations-1.f90 [flang] Lower real comparison operations 2022-02-25 21:03:39 +01:00
real-operations-2.f90 [flang] Lower real comparison operations 2022-02-25 21:03:39 +01:00
return-statement.f90 [flang] Lower simple RETURN statement 2022-02-10 18:36:04 +01:00
select-case-statement.f90 [flang] Lower select case statement 2022-03-18 15:41:29 +01:00
set-length.f90 [flang] Lower length on character storage 2022-03-18 14:52:59 +01:00
sqrt.f90 [Flang] Lower the sqrt intrinsics 2022-03-22 15:05:21 +00:00
statement-function.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
stop-statement.f90 [NFC][Flang] Add colon to CHECK-LABEL to exercise the check 2022-02-17 22:01:16 +00:00
structure-constructors.f90 [flang][NFC] Add lowering tests 2022-03-18 14:48:56 +01:00
transformational-intrinsics.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
trigonometric-intrinsics.f90 [Flang] Lower sin, cos intrinsics 2022-03-23 15:20:51 +00:00
user-defined-operators.f90 [flang][NFC] Add lowering tests 2022-03-18 14:48:56 +01:00
variable-inquiries.f90 [flang][NFC] Add lowering tests 2022-03-18 14:48:56 +01:00
variable.f90 [flang][NFC] Add lowering tests 2022-03-18 14:48:56 +01:00
vector-subscript-io.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
where.f90 [flang] Lower where statement 2022-03-10 18:44:23 +01:00
zero-size.f90 [flang][NFC] Add lowering tests 2022-03-18 14:48:56 +01:00