llvm-project/flang/lib/Evaluate
Peter Klausler be68a6adfb [flang] Error detection/avoidance for TRANSFER with empty MOLD= type
When MOLD= is an array and there is no SIZE= in a call to TRANSFER(),
the size of an element of the MOLD= is used as the denominator in a
division to establish the extent of the vector result.  When the
total storage size of the SOURCE= is known to be zero, the result is
empty and no division is needed.

To avoid a division by zero at runtime, we need to check for a zero-sized
MOLD= element type when the storage size of SOURCE= is nonzero and there
is no SIZE=.  Further, in the compilation-time rewriting of calls to
SHAPE(TRANSFER(...)) and SIZE(TRANSFER(...)) for constant folding and
simplification purposes, we can't replace the call with an arithmetic
element count expression when the storage size of SOURCE= is not known
to be zero and the element size of MOLD= is not known to be nonzero at
compilation time.

These changes mostly affect tests using a MOLD= argument that is an
assumed-length character.

Differential Revision: https://reviews.llvm.org/D129680
2022-07-13 16:50:57 -07:00
..
CMakeLists.txt [flang] Establish a single source of target information for semantics 2022-07-06 10:25:34 -07:00
call.cpp [flang] Add IsElementalProcedure() predicate 2022-07-06 18:08:45 -07:00
character.h [flang] Reformat with latest clang-format and .clang-format 2020-03-28 21:00:16 -07:00
characteristics.cpp [flang] Refine semantic checks for procedure pointer assignment 2022-07-13 14:56:50 -07:00
check-expression.cpp [flang] Don't discard lower bounds of implicit-shape named constants 2022-06-03 22:45:12 -07:00
common.cpp [flang] Fix wording of warning message 2022-06-23 11:15:35 -07:00
complex.cpp [flang] Reformat with latest clang-format and .clang-format 2020-03-28 21:00:16 -07:00
constant.cpp [flang] Fix UBOUND() folding for constant arrays 2022-04-28 01:17:47 +09:00
expression.cpp [flang] Add & use a better visit() (take 2) 2022-04-16 16:00:48 -07:00
fold-character.cpp [flang] Fold TRANSFER() 2022-07-13 15:34:48 -07:00
fold-complex.cpp [flang] Fold TRANSFER() 2022-07-13 15:34:48 -07:00
fold-designator.cpp [flang] Add & use a better visit() (take 2) 2022-04-16 16:00:48 -07:00
fold-implementation.h [flang] Fold TRANSFER() 2022-07-13 15:34:48 -07:00
fold-integer.cpp [flang] Fold TRANSFER() 2022-07-13 15:34:48 -07:00
fold-logical.cpp [flang] Fold TRANSFER() 2022-07-13 15:34:48 -07:00
fold-real.cpp [flang] Fold TRANSFER() 2022-07-13 15:34:48 -07:00
fold-reduction.cpp [flang] Fold FINDLOC() 2021-09-30 12:08:10 -07:00
fold-reduction.h [flang] Distinguish usage and portability warning messages 2022-03-08 17:24:52 -08:00
fold.cpp [flang] Fold TRANSFER() 2022-07-13 15:34:48 -07:00
formatting.cpp [flang] Add & use a better visit() (take 2) 2022-04-16 16:00:48 -07:00
host.cpp [flang] Establish a single source of target information for semantics 2022-07-06 10:25:34 -07:00
host.h [flang] Fix/work around warnings from GCC 11 2022-02-01 11:54:04 -08:00
initial-image.cpp [flang] Fold TRANSFER() 2022-07-13 15:34:48 -07:00
int-power.h [flang] Establish a single source of target information for semantics 2022-07-06 10:25:34 -07:00
integer.cpp [flang] Reformat with latest clang-format and .clang-format 2020-03-28 21:00:16 -07:00
intrinsics-library.cpp [flang] Establish a single source of target information for semantics 2022-07-06 10:25:34 -07:00
intrinsics.cpp [flang] Refine semantic checks for procedure pointer assignment 2022-07-13 14:56:50 -07:00
logical.cpp [flang] Reformat with latest clang-format and .clang-format 2020-03-28 21:00:16 -07:00
real.cpp [flang] Cope with overflow in real MOD/MODULO 2022-07-06 17:31:11 -07:00
shape.cpp [flang] Error detection/avoidance for TRANSFER with empty MOLD= type 2022-07-13 16:50:57 -07:00
static-data.cpp [flang] Establish a single source of target information for semantics 2022-07-06 10:25:34 -07:00
target.cpp [flang] Establish a single source of target information for semantics 2022-07-06 10:25:34 -07:00
tools.cpp [flang] Refine semantic checks for procedure pointer assignment 2022-07-13 14:56:50 -07:00
type.cpp [flang] Establish a single source of target information for semantics 2022-07-06 10:25:34 -07:00
variable.cpp [flang] Fix folding of LEN(f(...)) 2022-06-29 10:25:07 -07:00