[all-commits] [llvm/llvm-project] af54b6: [flang] Emit errors and warnings about DIM= argume...
Peter Klausler via All-commits
all-commits at lists.llvm.org
Sun Dec 4 13:04:58 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: af54b676e4712e81216eea66e92baa7ffba19a46
https://github.com/llvm/llvm-project/commit/af54b676e4712e81216eea66e92baa7ffba19a46
Author: Peter Klausler <pklausler at nvidia.com>
Date: 2022-12-04 (Sun, 04 Dec 2022)
Changed paths:
M flang/include/flang/Evaluate/fold.h
M flang/include/flang/Evaluate/tools.h
M flang/lib/Evaluate/fold-implementation.h
M flang/lib/Evaluate/fold-integer.cpp
M flang/lib/Evaluate/fold.cpp
M flang/lib/Evaluate/intrinsics.cpp
M flang/lib/Evaluate/tools.cpp
M flang/test/Lower/transformational-intrinsics.f90
A flang/test/Semantics/dim01.f90
Log Message:
-----------
[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
More information about the All-commits
mailing list