[flang-commits] [flang] d700988 - [flang] Improve warning message

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Tue Nov 1 10:32:56 PDT 2022


Author: Peter Klausler
Date: 2022-11-01T10:01:27-07:00
New Revision: d700988984635f680245a03325e94c821b87f026

URL: https://github.com/llvm/llvm-project/commit/d700988984635f680245a03325e94c821b87f026
DIFF: https://github.com/llvm/llvm-project/commit/d700988984635f680245a03325e94c821b87f026.diff

LOG: [flang] Improve warning message

When a floating-point exception occurs while folding an exponentiation
operation with a host library at compilation time, the warning message
should not say that it was an "intrinsic function".

Differential Revision: https://reviews.llvm.org/D137030

Added: 
    

Modified: 
    flang/lib/Evaluate/host.cpp
    flang/test/Evaluate/folding04.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Evaluate/host.cpp b/flang/lib/Evaluate/host.cpp
index a2282e9cd82cd..a5817bd0b59ad 100644
--- a/flang/lib/Evaluate/host.cpp
+++ b/flang/lib/Evaluate/host.cpp
@@ -141,7 +141,8 @@ void HostFloatingPointEnvironment::CheckAndRestoreFloatingPointEnvironment(
   }
 
   if (!flags_.empty()) {
-    RealFlagWarnings(context, flags_, "intrinsic function");
+    RealFlagWarnings(
+        context, flags_, "evaluation of intrinsic function or operation");
   }
   errno = 0;
   if (fesetenv(&originalFenv_) != 0) {

diff  --git a/flang/test/Evaluate/folding04.f90 b/flang/test/Evaluate/folding04.f90
index 4c669a4ec5983..99ee203b29b5c 100644
--- a/flang/test/Evaluate/folding04.f90
+++ b/flang/test/Evaluate/folding04.f90
@@ -17,26 +17,25 @@ module real_tests
   !WARN: warning: division by zero
   real(4), parameter :: r4_ninf = -1._4/0._4
 
-  !WARN: warning: invalid argument on intrinsic function
+  !WARN: warning: invalid argument on evaluation of intrinsic function or operation
   real(4), parameter :: nan_r4_acos1 = acos(1.1)
   TEST_ISNAN(nan_r4_acos1)
-  !WARN: warning: invalid argument on intrinsic function
+  !WARN: warning: invalid argument on evaluation of intrinsic function or operation
   real(4), parameter :: nan_r4_acos2 = acos(r4_pmax)
   TEST_ISNAN(nan_r4_acos2)
-  !WARN: warning: invalid argument on intrinsic function
+  !WARN: warning: invalid argument on evaluation of intrinsic function or operation
   real(4), parameter :: nan_r4_acos3 = acos(r4_nmax)
   TEST_ISNAN(nan_r4_acos3)
-  !WARN: warning: invalid argument on intrinsic function
+  !WARN: warning: invalid argument on evaluation of intrinsic function or operation
   real(4), parameter :: nan_r4_acos4 = acos(r4_ninf)
   TEST_ISNAN(nan_r4_acos4)
-  !WARN: warning: invalid argument on intrinsic function
+  !WARN: warning: invalid argument on evaluation of intrinsic function or operation
   real(4), parameter :: nan_r4_acos5 = acos(r4_pinf)
   TEST_ISNAN(nan_r4_acos5)
   !WARN: warning: second argument to MOD must not be zero
   real(4), parameter :: nan_r4_mod = mod(3.5, 0.)
   TEST_ISNAN(nan_r4_mod)
-
-  !WARN: warning: overflow on intrinsic function
+  !WARN: warning: overflow on evaluation of intrinsic function or operation
   logical, parameter :: test_exp_overflow = exp(256._4).EQ.r4_pinf
 end module
 


        


More information about the flang-commits mailing list