[flang-commits] [PATCH] D154377: [flang] Don't warn about a NaN argument to ISNAN()
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Mon Jul 3 13:26:02 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG08bfc002885f: [flang] Don't warn about a NaN argument to ISNAN() (authored by klausler).
Changed prior to commit:
https://reviews.llvm.org/D154377?vs=536840&id=536881#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154377/new/
https://reviews.llvm.org/D154377
Files:
flang/lib/Evaluate/fold-logical.cpp
flang/test/Evaluate/errors01.f90
Index: flang/test/Evaluate/errors01.f90
===================================================================
--- flang/test/Evaluate/errors01.f90
+++ flang/test/Evaluate/errors01.f90
@@ -176,7 +176,21 @@
integer, parameter :: bad4 = dim(huge(1),-1)
!CHECK: warning: HYPOT intrinsic folding overflow
real, parameter :: bad5 = hypot(huge(0.), huge(0.))
+ !CHECK: warning: SUM() of INTEGER(4) data overflowed
+ integer, parameter :: bad6 = sum([huge(1),huge(1)])
+ !CHECK: warning: SUM() of REAL(4) data overflowed
+ real, parameter :: bad7 = sum([huge(1.),huge(1.)])
+ !CHECK: warning: SUM() of COMPLEX(4) data overflowed
+ complex, parameter :: bad8 = sum([(huge(1.),0.),(huge(1.),0.)])
+ !CHECK: warning: PRODUCT() of INTEGER(4) data overflowed
+ integer, parameter :: bad9 = product([huge(1),huge(1)])
+ !CHECK: warning: PRODUCT() of REAL(4) data overflowed
+ real, parameter :: bad10 = product([huge(1.),huge(1.)])
+ !CHECK: warning: PRODUCT() of COMPLEX(4) data overflowed
+ complex, parameter :: bad11 = product([(huge(1.),0.),(huge(1.),0.)])
!CHECK: warning: overflow on REAL(8) to REAL(4) conversion
x = 1.D40
+ !CHECK-NOT: warning: invalid argument
+ if (.not. isnan(real(z'ffffffffffffffff',8))) stop
end subroutine
end module
Index: flang/lib/Evaluate/fold-logical.cpp
===================================================================
--- flang/lib/Evaluate/fold-logical.cpp
+++ flang/lib/Evaluate/fold-logical.cpp
@@ -155,10 +155,11 @@
}
}
} else if (name == "isnan" || name == "__builtin_ieee_is_nan") {
- using DefaultReal = Type<TypeCategory::Real, 4>;
// Only replace the type of the function if we can do the fold
if (args[0] && args[0]->UnwrapExpr() &&
IsActuallyConstant(*args[0]->UnwrapExpr())) {
+ auto restorer{context.messages().DiscardMessages()};
+ using DefaultReal = Type<TypeCategory::Real, 4>;
return FoldElementalIntrinsic<T, DefaultReal>(context, std::move(funcRef),
ScalarFunc<T, DefaultReal>([](const Scalar<DefaultReal> &x) {
return Scalar<T>{x.IsNotANumber()};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154377.536881.patch
Type: text/x-patch
Size: 2144 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230703/393c5332/attachment-0001.bin>
More information about the flang-commits
mailing list