[flang-commits] [PATCH] D126584: [flang] Avoid spurious warnings from reading module files

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri May 27 20:18:00 PDT 2022


klausler created this revision.
klausler added a reviewer: vdonaldson.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.

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.


https://reviews.llvm.org/D126584

Files:
  flang/docs/Extensions.md
  flang/include/flang/Evaluate/common.h
  flang/include/flang/Semantics/expression.h
  flang/include/flang/Semantics/semantics.h
  flang/lib/Evaluate/fold-implementation.h
  flang/lib/Semantics/expression.cpp
  flang/lib/Semantics/mod-file.cpp
  flang/lib/Semantics/semantics.cpp
  flang/test/Semantics/dosemantics03.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126584.432687.patch
Type: text/x-patch
Size: 10934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220528/501d6104/attachment-0001.bin>


More information about the flang-commits mailing list