rsmith added a comment. > @rsmith asked "I don't see changes to the constant evaluator". The semantic > rules for enabling this pragma require that strict or precise semantics be in > effect., see SemaAttr.cpp And the floating point constant evaluation doesn't > occur when strict or precise
What do you mean "the floating point constant evaluation doesn't occur when strict or precise"? I don't see any code to do that in `ExprConstant.cpp`, neither in trunk nor in this patch. The constant evaluator certainly is still invoked when we're in strict or precise mode. I would expect the evaluator would need to check for FP strictness whenever it encounters a floating-point operator (eg, here: https://github.com/llvm/llvm-project/blob/master/clang/lib/AST/ExprConstant.cpp#L13340), and treat such cases as non-constant. I'd like to see a C++ test for something like this: float myAdd() { #pragma STDC FENV_ACCESS ON static double v = 1.0 / 3.0; return v; } If that generates a runtime guarded initialization for `v`, then I'd be a bit more convinced we're getting this right. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D87528/new/ https://reviews.llvm.org/D87528 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits