[clang] [clang] Make -fveclib={ArmPL, SLEEF} imply -fno-math-errno (PR #112580)

Benjamin Maxwell via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 21 04:52:48 PDT 2024


================
@@ -2960,6 +2969,12 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
   }
 
   for (const Arg *A : Args) {
+    auto CheckMathErrnoForVecLib =
+        llvm::make_scope_exit([&, MathErrnoBeforeArg = MathErrno] {
+          if (NoMathErrnoWasImpliedByVecLib && !MathErrnoBeforeArg && MathErrno)
+            ArgThatEnabledMathErrnoAfterVecLib = A;
+        });
----------------
MacDue wrote:

Maybe a little contrived, but the suggested check will give a _kinda_ incorrect warning in some cases:

Given this (somewhat) contrived example:
`-fveclib=ArmPL -fno-fast-math -fno-math-errno -ffp-model=strict`

The current check will warn about `-ffp-model=strict` which is the option that in the end turns on `-fmath-errno`, the suggested check will warn about `-fno-fast-math`, which is not really correct as there's `-fno-math-errno` after it.

https://github.com/llvm/llvm-project/pull/112580


More information about the cfe-commits mailing list