$OpenBSD: patch-tools_clang_lib_Frontend_CompilerInstance_cpp,v 1.1 2020/11/18 21:20:00 jca Exp $

Disable strict floating point if not X86.

Index: tools/clang/lib/Frontend/CompilerInstance.cpp
--- tools/clang/lib/Frontend/CompilerInstance.cpp.orig
+++ tools/clang/lib/Frontend/CompilerInstance.cpp
@@ -927,6 +927,19 @@ bool CompilerInstance::ExecuteAction(FrontendAction &A
     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
