This is an archive of the discontinued LLVM Phabricator instance.

[flang] Avoid spurious warnings from reading module files
ClosedPublic

Authored by klausler on May 27 2022, 8:17 PM.

Details

Summary

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.

Diff Detail

Event Timeline

klausler created this revision.May 27 2022, 8:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 27 2022, 8:17 PM
Herald added a subscriber: jdoerfert. · View Herald Transcript
klausler requested review of this revision.May 27 2022, 8:17 PM
vdonaldson accepted this revision.May 27 2022, 8:49 PM
This revision is now accepted and ready to land.May 27 2022, 8:49 PM