[all-commits] [llvm/llvm-project] 735062: [flang] Avoid spurious warnings from reading modul...

Peter Klausler via All-commits all-commits at lists.llvm.org
Sat May 28 08:56:21 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 73506256bff646a2283121b8497750ec74a016cd
      https://github.com/llvm/llvm-project/commit/73506256bff646a2283121b8497750ec74a016cd
  Author: Peter Klausler <pklausler at nvidia.com>
  Date:   2022-05-28 (Sat, 28 May 2022)

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

  Log Message:
  -----------
  [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




More information about the All-commits mailing list