[PATCH] D79510: [PATCH] When pragma FENV_ACCESS is ignored do not modify Sema.CurFPFeatures

Melanie Blower via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 6 13:36:05 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGe5578013b199: When pragma FENV_ACCESS is ignored do not modify Sema.CurFPFeatures Bug… (authored by mibintc).

Changed prior to commit:
  https://reviews.llvm.org/D79510?vs=262434&id=262467#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79510/new/

https://reviews.llvm.org/D79510

Files:
  clang/lib/Parse/ParsePragma.cpp
  clang/test/CodeGen/fp-floatcontrol-pragma.cpp
  clang/test/Parser/fp-floatcontrol-syntax.cpp


Index: clang/test/Parser/fp-floatcontrol-syntax.cpp
===================================================================
--- clang/test/Parser/fp-floatcontrol-syntax.cpp
+++ clang/test/Parser/fp-floatcontrol-syntax.cpp
@@ -30,14 +30,15 @@
 //      document the warning
 #ifdef FAST
 // expected-warning at +1{{pragma STDC FENV_ACCESS ON is not supported, ignoring pragma}}
-#pragma STDC FENV_ACCESS ON // expected-error{{'#pragma STDC FENV_ACCESS ON' is illegal when precise is disabled}}
+#pragma STDC FENV_ACCESS ON
 #else
 #pragma STDC FENV_ACCESS ON // expected-warning{{pragma STDC FENV_ACCESS ON is not supported, ignoring pragma}}
 #endif
 #ifdef STRICT
 #pragma float_control(precise, off) // expected-error {{'#pragma float_control(precise, off)' is illegal when except is enabled}}
 #else
-#pragma float_control(precise, off) // expected-error {{'#pragma float_control(precise, off)' is illegal when fenv_access is enabled}}
+// Currently FENV_ACCESS cannot be enabled by pragma, skip error check
+#pragma float_control(precise, off) // not-expected-error {{'#pragma float_control(precise, off)' is illegal when fenv_access is enabled}}
 #endif
 
 #pragma float_control(precise, on)
Index: clang/test/CodeGen/fp-floatcontrol-pragma.cpp
===================================================================
--- clang/test/CodeGen/fp-floatcontrol-pragma.cpp
+++ clang/test/CodeGen/fp-floatcontrol-pragma.cpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -verify -DFENV_ON=1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
 
 float fff(float x, float y) {
 // CHECK-LABEL: define float @_Z3fffff{{.*}}
@@ -38,6 +39,7 @@
   }
   return z;
 }
+
 float fma_test1(float a, float b, float c) {
 // CHECK-LABEL define float @_Z9fma_test1fff{{.*}}
 #pragma float_control(precise, on)
@@ -45,3 +47,15 @@
   //CHECK: fmuladd
   return x;
 }
+
+#if FENV_ON
+// expected-warning at +1{{pragma STDC FENV_ACCESS ON is not supported, ignoring pragma}}
+#pragma STDC FENV_ACCESS ON
+#endif
+// CHECK-LABEL: define {{.*}}callt{{.*}}
+
+void callt() {
+  volatile float z;
+  z = z * z;
+//CHECK: = fmul float
+}
Index: clang/lib/Parse/ParsePragma.cpp
===================================================================
--- clang/lib/Parse/ParsePragma.cpp
+++ clang/lib/Parse/ParsePragma.cpp
@@ -108,6 +108,7 @@
      return;
     if (OOS == tok::OOS_ON) {
       PP.Diag(Tok, diag::warn_stdc_fenv_access_not_supported);
+      return;
     }
 
     MutableArrayRef<Token> Toks(PP.getPreprocessorAllocator().Allocate<Token>(1),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79510.262467.patch
Type: text/x-patch
Size: 2589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200506/f19ca334/attachment.bin>


More information about the cfe-commits mailing list