[PATCH] D122155: Add warning when eval-method is set in the presence of value unsafe floating-point calculations.

Andy Kaylor via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 22 13:32:42 PDT 2022


andrew.w.kaylor added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticFrontendKinds.td:50-53
+def warn_eval_method_setting_via_option_in_value_unsafe_context : Warning<
+    "setting the eval method via '-ffp-eval-method' has not effect when numeric "
+    "results of floating-point calculations aren't value-safe.">,
+    InGroup<IncompatibleFPOpts>;
----------------
zahiraam wrote:
> aaron.ballman wrote:
> > Unless you have a strong reason for this to be a warning, this seems like a situation we should diagnose as an error with a much clearer message.
> May  be @andrew.w.kaylor would weigh in on this?
I was going to say that for the command line option we could just issue a warning saying that the later option overrides the earlier, but it's a bit complicated to sort out what that would mean if the eval method follows a fast-math option and it might not always be what the user intended. So, I guess I'd agree that it should be an error.

For the case with pragmas, the model I'd follow is the mixing of #pragma float_control(except, on) with a fast-math mode or #pragma float_control(precise, off) with a non-ignore exception mode. In both those cases we issue an error.


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

https://reviews.llvm.org/D122155



More information about the cfe-commits mailing list