llvm-project/flang/lib/Evaluate
Peter Klausler 73506256bf [flang] Avoid spurious warnings from reading module files
When processing the literal constants of the various kinds of
INTEGER that are too large by 1 (e.g., 2147483648_4) in expression
analysis, emit a portability warning rather than a fatal error if
the literal constant appears as the operand to a unary minus, since
the folded result will be in range.  And don't emit any warning if
the negated literal is coming from a module file -- f18 wrote the
module file and the warning would simply be confusing, especially to
the programmer that wrote (-2147483647_4-1) in the first place.

Further, emit portability warnings for the canonical expressions for
infinities and NaN (-1./0., 0./0., & 1./0.), but not when they appear
in a module file, for the same reason.  The Fortran language has no
syntax for these special values so we have to emit expressions that
fold to them.

Fixes LLVM bugs https://github.com/llvm/llvm-project/issues/55086 and
https://github.com/llvm/llvm-project/issues/55081.

Differential Revision: https://reviews.llvm.org/D126584
2022-05-28 08:07:54 -07:00
..
CMakeLists.txt [flang] Improve runtime interface with C99 complex 2021-10-01 08:45:24 +02:00
call.cpp [flang] Add & use a better visit() (take 2) 2022-04-16 16:00:48 -07:00
character.h [flang] Reformat with latest clang-format and .clang-format 2020-03-28 21:00:16 -07:00
characteristics.cpp [flang] Fix use-associated false-positive error 2022-05-20 12:14:02 +03:00
check-expression.cpp [flang] Allow local variables and function result inquiries in specification expressions 2022-05-10 16:47:03 -07:00
common.cpp [flang] Distinguish usage and portability warning messages 2022-03-08 17:24:52 -08: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 SCALE() 2022-01-15 09:31:00 -08:00
fold-complex.cpp [flang] Distinguish usage and portability warning messages 2022-03-08 17:24:52 -08:00
fold-designator.cpp [flang] Add & use a better visit() (take 2) 2022-04-16 16:00:48 -07:00
fold-implementation.h [flang] Avoid spurious warnings from reading module files 2022-05-28 08:07:54 -07:00
fold-integer.cpp [flang] Support FINDLOC/MAXLOC/MINLOC with scalar mask 2022-04-28 18:59:04 +09:00
fold-logical.cpp [flang] Fold intrinsic inquiry functions SAME_TYPE_AS() and EXTENDS_TYPE_OF() 2022-05-09 13:38:18 -07:00
fold-real.cpp [flang] Fold complex component references 2022-05-11 10:04:13 -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] Ensure that structure constructors fold parameter references 2022-05-09 16:09:49 -07:00
formatting.cpp [flang] Add & use a better visit() (take 2) 2022-04-16 16:00:48 -07:00
host.cpp [flang] Distinguish usage and portability warning messages 2022-03-08 17:24:52 -08:00
host.h [flang] Fix/work around warnings from GCC 11 2022-02-01 11:54:04 -08:00
initial-image.cpp [flang] Allow DATA initialization of derived types w/ allocatable components 2022-02-14 10:43:49 -08:00
int-power.h [flang] Reformat with latest clang-format and .clang-format 2020-03-28 21:00:16 -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] Fold real-valued MODULO() and MOD() 2022-05-10 08:15:29 -07:00
intrinsics.cpp [flang] Fix check for assumed-size arguments to SHAPE() & al. 2022-05-11 10:33:17 -07:00
logical.cpp [flang] Reformat with latest clang-format and .clang-format 2020-03-28 21:00:16 -07:00
real.cpp [flang] Fold real-valued MODULO() and MOD() 2022-05-10 08:15:29 -07:00
shape.cpp [flang] Add & use a better visit() (take 2) 2022-04-16 16:00:48 -07:00
static-data.cpp [flang] Reformat with latest clang-format and .clang-format 2020-03-28 21:00:16 -07:00
tools.cpp [flang] Extension: Accept Hollerith actual arguments as if they were BOZ 2022-05-24 09:04:31 -07:00
type.cpp [flang] Fold intrinsic inquiry functions SAME_TYPE_AS() and EXTENDS_TYPE_OF() 2022-05-09 13:38:18 -07:00
variable.cpp [flang] Add & use a better visit() (take 2) 2022-04-16 16:00:48 -07:00