diff options
author | 2020-09-10 20:28:13 +0000 | |
---|---|---|
committer | 2020-09-10 20:28:13 +0000 | |
commit | c090f2041eb492fe987c78c48e798d9bc57c5191 (patch) | |
tree | 9a770022675d20926cd695a1ad045b99bf61b309 /gnu/llvm/clang/lib/Frontend/CompilerInstance.cpp | |
parent | Move the tcp/udp keyword before <address>. This allows for easier adding (diff) | |
download | wireguard-openbsd-c090f2041eb492fe987c78c48e798d9bc57c5191.tar.xz wireguard-openbsd-c090f2041eb492fe987c78c48e798d9bc57c5191.zip |
Disable strict floating point if not X86
Disable options like clang -fno-unsafe-math-optimizations for all
targets except X86 (and SystemZ). This prevents a crash of clang,
reported by cwen@, in graphics/babl or emulators/mednafen for powerpc.
ok mortimer@
This change comes from llvm 11.x:
https://github.com/llvm/llvm-project/commit/d4ce862
Reland "[FPEnv][Clang][Driver] Disable constrained floating point on targets lacking support."
We currently have strict floating point/constrained floating point enabled
for all targets. Constrained SDAG nodes get converted to the regular ones
before reaching the target layer. In theory this should be fine.
However, the changes are exposed to users through multiple clang options
already in use in the field, and the changes are _completely_ _untested_
on almost all of our targets. Bugs have already been found, like
"https://bugs.llvm.org/show_bug.cgi?id=45274".
This patch disables constrained floating point options in clang everywhere
except X86 and SystemZ. A warning will be printed when this happens.
Use the new -fexperimental-strict-floating-point flag to force allowing
strict floating point on hosts that aren't already marked as supporting
it (X86 and SystemZ).
Differential Revision: https://reviews.llvm.org/D80952
Diffstat (limited to 'gnu/llvm/clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | gnu/llvm/clang/lib/Frontend/CompilerInstance.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gnu/llvm/clang/lib/Frontend/CompilerInstance.cpp b/gnu/llvm/clang/lib/Frontend/CompilerInstance.cpp index 688f21dd090..c9a65bc0ec1 100644 --- a/gnu/llvm/clang/lib/Frontend/CompilerInstance.cpp +++ b/gnu/llvm/clang/lib/Frontend/CompilerInstance.cpp @@ -927,6 +927,19 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) { setAuxTarget(TargetInfo::CreateTargetInfo(getDiagnostics(), TO)); } + if (!getTarget().hasStrictFP() && !getLangOpts().ExpStrictFP) { + if (getLangOpts().getFPRoundingMode() != + LangOptions::FPR_ToNearest) { + getDiagnostics().Report(diag::warn_fe_backend_unsupported_fp_rounding); + getLangOpts().setFPRoundingMode(LangOptions::FPR_ToNearest); + } + if (getLangOpts().getFPExceptionMode() != LangOptions::FPE_Ignore) { + getDiagnostics().Report(diag::warn_fe_backend_unsupported_fp_exceptions); + getLangOpts().setFPExceptionMode(LangOptions::FPE_Ignore); + } + // FIXME: can we disable FEnvAccess? + } + // Inform the target of the language options. // // FIXME: We shouldn't need to do this, the target should be immutable once |