llvm-project/flang/test/Lower
Peter Klausler af54b676e4 [flang] Emit errors and warnings about DIM= arguments to intrinsic functions
The semantics of many transformational intrinsic functions, especially
reductions like SUM(), are determined by the static presence or absence
of a DIM= argument.  In the case of an actual DIM= argument that is
syntactically present but could be dynamically absent at execution time
(due to being OPTIONAL, POINTER, or ALLOCATABLE), f18 should emit some
kind of diagnostic message.

Other compilers either ignore this possibility or treat it as a hard
error; neither really seems correct, so let's do something more nuanced.

For cases where the dynamic absence of a value for DIM doesn't pose
as much of a risk because it lowering is going to assume that it's
equal to 1 anyway, emit only a portability warning.

For other cases where the generated code or runtime support library
will need the value of DIM= during execution, emit a warning that
the use of an OPTIONAL/POINTER/ALLOCATABLE variable or component
here is dicey and should be reconsidered.

While here, also catch bad constant DIM= values.

Differential Revision: https://reviews.llvm.org/D139155
2022-12-04 13:04:36 -08:00
..
HLFIR [flang] Lower conversions to HLFIR 2022-12-02 16:19:38 +01:00
Intrinsics [flang] Lower F08 FINDLOC intrinsic 2022-11-29 10:18:38 -07:00
OpenACC [flang][openacc][NFC] Add test with allocatable and pointer arrays 2022-08-15 16:45:08 +02:00
OpenMP [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
forall [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
allocatable-assignment.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
allocatable-callee.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
allocatable-caller.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
allocatable-globals.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
allocatable-polymorphic.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
allocatable-runtime.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
allocatables.f90 [flang] Handle reversed bounds and negative length in inlined allocation 2022-06-13 17:35:03 +02: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
always-execute-loop-body.f90 [Flang] Add flag dependent code to execute the loop-body atleast once 2022-06-07 10:12:09 +00:00
arguments.f90 [flang] Handle allocatable dummy arguments 2022-02-24 17:16:55 +01:00
arithmetic-goto.f90 [flang] Add lowering tests 2022-06-28 15:22:21 +02:00
array-character.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
array-constructor-1.f90 [flang] Add lowering tests 2022-06-28 15:22:21 +02:00
array-constructor-2.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
array-copy-semantics.f90 [flang] Add lowering tests 2022-06-28 15:22:21 +02:00
array-copy.f90 [flang] Add lowering tests 2022-06-28 15:22:21 +02:00
array-derived-assignments.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
array-derived.f90 [flang][NFC] Add array lowering tests 2022-06-27 14:19:54 +02:00
array-elemental-calls-2.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
array-elemental-calls-char-byval.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
array-elemental-calls-char.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
array-elemental-calls.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
array-elemental-subroutines.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
array-expression-assumed-size.f90 [flang] Add lowering tests 2022-06-28 15:22:21 +02:00
array-expression-slice-1.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
array-expression-slice-2.f90 [flang] Add lowering tests 2022-06-28 15:22:21 +02: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] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
array-substring.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
array-temp.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
array-user-def-assignments.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
array-wide-char.f90 [flang] Correct bug in literal CHARACTER constant names 2022-06-30 10:10:37 +02:00
array.f90 [flang] Add lowering tests 2022-06-28 15:22:21 +02:00
assigned-goto.f90 [flang] Lower computed and assigned goto 2022-03-08 20:19:18 +01:00
assignment.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
associate-construct-2.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
associate-construct.f90 [flang] Move main variables static promotion from lowering into IsSaved 2022-09-28 08:37:22 +02:00
assumed-shape-callee.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
assumed-shape-caller.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
attributes.f90 [flang][NFC] Add misc lowering tests 2022-03-23 15:24:40 +01:00
basic-call.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00: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
bbcnull.f90 [flang] Add lowering tests 2022-06-28 15:22:21 +02:00
big-integer-parameter.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
c-interoperability-bindc-variables.f90 [flang] Handle BINC(C) variables and add TODO for corner cases 2022-06-22 20:47:23 +02:00
c-interoperability-c-pointer.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
c-interoperability.f90 [flang] Add lowering C interoperability test 2022-03-23 15:23:34 +01:00
call-by-value-attr.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
call-by-value.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
call-copy-in-out.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
call-implicit.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
call-parenthesized-arg.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
call-site-mangling.f90 [flang] Enforce C815 2022-10-30 14:50:31 -07:00
call-suspect.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
call.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
character-assignment.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
character-compare.f90 [flang][NFC] Add character lowering tests 2022-03-23 15:28:29 +01:00
character-concatenation.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
character-elemental.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
character-local-variables.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
character-substrings.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
common-block-2.f90 [flang] Handle common block with different sizes in same file 2022-04-29 14:52:47 +02:00
common-block.f90 [flang][driver] Make `flang-new -fc1` accept MLIR files 2022-06-10 10:58:54 +00:00
compiler-directive.f90 [flang][lowering] Ignore compiler directives 2022-06-10 15:26:49 +00:00
complex-operations.f90 [flang][NFC] Add complex operations lowering tests 2022-02-28 21:37:34 +01:00
complex-part.f90 [mlir][flang] Make use of the new `GEPArg` builder of GEP Op to simplify code 2022-08-01 17:22:55 +02:00
components.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00: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
convert.f90 [Flang] Add -fconvert option to swap endianness for unformatted files. 2022-10-12 16:57:37 -07:00
default-initialization-globals.f90 [flang] Handle NULL(mold) used in initializer region 2022-09-24 15:23:08 +02:00
default-initialization.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
dense-attributed-array.f90 [flang][NFC] Add more lowering tests 2022-03-24 00:09:06 +01:00
derived-allocatable-components.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
derived-assignments.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
derived-pointer-components.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
derived-type-descriptor.f90 [flang] Represent TARGET for globals with 'target' attribute. 2022-10-06 19:14:28 -07:00
derived-type-temp.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
derived-types-kind-params.f90 [flang] Fold instantiated PDT character component length when needed 2022-04-04 09:47:15 +02:00
derived-types.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
dispatch-table.f90 [flang] Create fir.dispatch_table and fir.dt_entry operations 2022-11-17 10:53:43 +01:00
dispatch.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
do_loop.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
do_loop_unstructured.f90 [flang] Keep original data type for do-variable value. 2022-08-23 15:54:54 -07:00
dummy-argument-assumed-shape-optional.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
dummy-argument-contiguous.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
dummy-argument-derived.f90 [flang] Do not pass derived type by descriptor when not needed 2022-04-20 10:00:34 +02:00
dummy-argument-optional-2.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
dummy-argument-optional.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
dummy-arguments.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
dummy-procedure-character.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
dummy-procedure-in-entry.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
dummy-procedure.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
entry-statement.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
environment-defaults.f90 [Flang] Add -fconvert option to swap endianness for unformatted files. 2022-10-12 16:57:37 -07:00
equivalence-1.f90 [flang] Add equivalence lowering tests 2022-03-17 17:16:19 +01:00
equivalence-2.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
equivalence-static-init.f90 [flang] Add equivalence lowering tests 2022-03-17 17:16:19 +01:00
explicit-interface-results-2.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
explicit-interface-results.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
ext-proc-as-actual-argument-1.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
ext-proc-as-actual-argument-2.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
extent_triplets.f90 [flang] Avoid segfault when defining op is not a fir::Convert 2022-07-04 16:03:02 +02:00
fail_image.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
fast-math-arithmetic.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00: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] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
host-associated-functions.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
host-associated.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
identical-block-merge-disable.f90 [flang][NFC] Add more lowering tests 2022-03-24 00:09:06 +01:00
ifconvert.f90 [flang] Add lowering tests 2022-06-28 15:22:21 +02:00
implicit-interface.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
infinite_loop.f90 [flang] Make use of do variable more consistent. 2022-09-01 15:46:19 -07:00
integer-operations.f90 [flang] Lower integer comparison operation 2022-02-25 21:01:27 +01:00
intentout-deallocate.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
intrinsic-procedure-wrappers.f90 [flang] Add lowering tests 2022-06-28 15:22:21 +02:00
io-char-array.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
io-implied-do-fixes.f90 [flang][NFC] Add IO lowering tests 2022-06-27 15:01:33 +02:00
io-item-list.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
io-statement-1.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
io-statement-2.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
io-statement-3.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
io-statement-big-unit-checks.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
io-statement-clean-ups.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
io-statement-open-options.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
io-write.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
irreducible.f90 [flang] Add lowering tests 2022-06-28 15:22:21 +02:00
logical-as-fortran.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
logical-operations.f90 [flang] Lower logical comparison and logical operations 2022-02-25 21:05:44 +01:00
loops.f90 [flang] Keep original data type for do-variable value. 2022-08-23 15:54:54 -07:00
loops2.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
math-lowering.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
memory-alloc.f90 [flang] Fix for array upper bounds with * 2022-06-30 10:37:22 +02:00
mixed_loops.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00: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] Represent TARGET for globals with 'target' attribute. 2022-10-06 19:14:28 -07:00
module_definition.f90 [flang] Handle common block with different sizes in same file 2022-04-29 14:52:47 +02:00
module_use.f90 [flang] Handle common block with different sizes in same file 2022-04-29 14:52:47 +02:00
module_use_in_same_file.f90 [flang][NFC] Add module lowering tests 2022-03-23 17:51:09 +01:00
namelist-common-block.f90 [flang] Load allocatable or pointer box of namelist item from common block 2022-09-23 08:30:02 +02:00
namelist.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
nested-where.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
non-standard-extensions.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
nullify-polymorphic.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
nullify.f90 [flang][NFC] Fix lowering tests indent 2022-03-23 09:24:18 +01:00
optional-value-caller.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
parent-component.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
pause-statement.f90 [flang] Lower PAUSE statement 2022-02-02 08:16:12 +01:00
pointer-args-callee.f90 [flang] Lower assumed length character allocatable and pointer arguments 2022-10-13 11:03:56 -07:00
pointer-args-caller.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
pointer-assignments.f90 [flang] Fix one corner case in reshape intrinsic 2022-06-30 23:52:44 +08:00
pointer-association-polymorphic.f90 [flang] Handle pointer assignment with polymorphic entities 2022-11-01 21:46:32 +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] Handle common block with different sizes in same file 2022-04-29 14:52:47 +02:00
pointer-initial-target.f90 [flang] Fix one corner case in reshape intrinsic 2022-06-30 23:52:44 +08:00
pointer-references.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
pointer-results-as-arguments.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00: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
polymorphic-types.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
polymorphic.f90 [flang] Perform assignment to polymorphic allocatable with runtime call 2022-12-02 15:51:20 +01:00
power-operator.f90 [flang] Use mlir complex dialect for supported operations 2022-10-26 12:37:15 +00: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
pre-fir-tree04.f90 [Flang] Lower the FailImage Statement 2022-04-27 12:20:25 +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] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
program-units-fir-mangling.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
read-write-buffer.f90 [flang] Noncontiguous formats 2022-08-24 13:51:16 -07:00
real-operations-1.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
real-operations-2.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
return-statement.f90 [flang] Lower simple RETURN statement 2022-02-10 18:36:04 +01:00
select-case-statement.f90 [flang] Fix invalid branch optimization 2022-09-11 19:37:32 -07:00
select-type.f90 [flang] Enable character type guard in select type 2022-12-02 09:53:48 +01:00
sqrt.f90 [flang] Use mlir complex dialect for supported operations 2022-10-26 12:37:15 +00:00
statement-function.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
stop-statement.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
structure-constructors.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
target_definition.f90 [flang] Represent TARGET for globals with 'target' attribute. 2022-10-06 19:14:28 -07:00
target_use.f90 [flang] Represent TARGET for globals with 'target' attribute. 2022-10-06 19:14:28 -07:00
transformational-intrinsics.f90 [flang] Emit errors and warnings about DIM= arguments to intrinsic functions 2022-12-04 13:04:36 -08:00
trigonometric-intrinsics.f90 [flang] Use mlir complex dialect for supported operations 2022-10-26 12:37:15 +00:00
user-defined-operators.f90 [flang][NFC] Add lowering tests 2022-03-18 14:48:56 +01:00
variable-inquiries.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
variable.f90 [flang][NFC] Add lowering tests 2022-03-18 14:48:56 +01:00
vector-subscript-io.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
where-allocatable-assignments.f90 [flang] Deallocate WHERE masks after all assignments 2022-09-20 10:40:30 +02:00
where.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
while_loop.f90 [flang] Set default to -ffpcontract=fast 2022-11-17 15:49:51 +00:00
zero-size.f90 [flang][NFC] Add lowering tests 2022-03-18 14:48:56 +01:00