[clang] [clang][driver] Improve warning message for complex range overrides (PR #154899)
Shunsuke Watanabe via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 10 17:51:28 PDT 2025
https://github.com/s-watanabe314 updated https://github.com/llvm/llvm-project/pull/154899
>From af1b40c0a668c7fba5eb01801b66bb2bf2da00ff Mon Sep 17 00:00:00 2001
From: s-watanabe314 <watanabe.shu-06 at fujitsu.com>
Date: Thu, 14 Aug 2025 16:52:33 +0900
Subject: [PATCH 1/4] [clang][driver] Improve warning message for complex range
overrides
This patch improves the warnings to show which user options override
the complex range. When a complex range is overridden, explicitly
display both the option name and the implied complex range value for
both the overriding and the overridden options.
See also the discussion in the following discourse post:
https://discourse.llvm.org/t/the-priority-of-fno-fast-math-regarding-complex-number-calculations/84679
---
.../clang/Basic/DiagnosticDriverKinds.td | 3 +
clang/lib/Driver/ToolChains/Clang.cpp | 164 ++---
clang/lib/Driver/ToolChains/CommonArgs.cpp | 3 +
clang/test/Driver/cl-options.c | 6 +-
clang/test/Driver/fp-model.c | 11 +-
clang/test/Driver/range-wanings.c | 605 ++++++++++++++++++
clang/test/Driver/range.c | 63 +-
7 files changed, 689 insertions(+), 166 deletions(-)
create mode 100644 clang/test/Driver/range-wanings.c
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 6df8f9932f30f..fad8afd98b1a3 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -488,6 +488,9 @@ def warn_drv_overriding_option : Warning<
def warn_drv_overriding_deployment_version
: Warning<"overriding deployment version from '%0' to '%1'">,
InGroup<DiagGroup<"overriding-deployment-version">>;
+def warn_drv_overriding_complex_range : Warning<
+ "'%1' sets complex range to \"%3\" overriding the setting of \"%2\" that was implied by '%0'">,
+ InGroup<DiagGroup<"overriding-complex-range">>;
def warn_drv_treating_input_as_cxx : Warning<
"treating '%0' input as '%1' when in C++ mode, this behavior is deprecated">,
InGroup<Deprecated>;
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 29b7180df5cb5..81f1d2dbac349 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2730,17 +2730,38 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
}
}
-static std::string ComplexArithmeticStr(LangOptions::ComplexRangeKind Range) {
- return (Range == LangOptions::ComplexRangeKind::CX_None)
- ? ""
- : "-fcomplex-arithmetic=" + complexRangeKindToStr(Range);
-}
+static void EmitComplexRangeDiag(const Driver &D, StringRef LastOpt,
+ LangOptions::ComplexRangeKind Range,
+ StringRef NewOpt,
+ LangOptions::ComplexRangeKind NewRange) {
+ // Do not emit a warning if NewOpt overrides LastOpt in the following cases.
+ //
+ // | LastOpt | NewOpt |
+ // |-----------------------|-----------------------|
+ // | -fcx-limited-range | -fno-cx-limited-range |
+ // | -fno-cx-limited-range | -fcx-limited-range |
+ // | -fcx-fortran-rules | -fno-cx-fortran-rules |
+ // | -fno-cx-fortran-rules | -fcx-fortran-rules |
+ // | -ffast-math | -fno-fast-math |
+ // | -ffp-model= | -fno-fast-math |
+ // | -ffp-model= | -ffp-model= |
+ // | -fcomplex-arithmetic= | -fcomplex-arithmetic= |
+ if (LastOpt == NewOpt || NewOpt.empty() || LastOpt.empty() ||
+ (LastOpt == "-fcx-limited-range" && NewOpt == "-fno-cx-limited-range") ||
+ (LastOpt == "-fno-cx-limited-range" && NewOpt == "-fcx-limited-range") ||
+ (LastOpt == "-fcx-fortran-rules" && NewOpt == "-fno-cx-fortran-rules") ||
+ (LastOpt == "-fno-cx-fortran-rules" && NewOpt == "-fcx-fortran-rules") ||
+ (LastOpt == "-ffast-math" && NewOpt == "-fno-fast-math") ||
+ (LastOpt.starts_with("-ffp-model=") && NewOpt == "-fno-fast-math") ||
+ (LastOpt.starts_with("-ffp-model=") &&
+ NewOpt.starts_with("-ffp-model=")) ||
+ (LastOpt.starts_with("-fcomplex-arithmetic=") &&
+ NewOpt.starts_with("-fcomplex-arithmetic=")))
+ return;
-static void EmitComplexRangeDiag(const Driver &D, std::string str1,
- std::string str2) {
- if (str1 != str2 && !str2.empty() && !str1.empty()) {
- D.Diag(clang::diag::warn_drv_overriding_option) << str1 << str2;
- }
+ D.Diag(clang::diag::warn_drv_overriding_complex_range)
+ << LastOpt << NewOpt << complexRangeKindToStr(Range)
+ << complexRangeKindToStr(NewRange);
}
static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
@@ -2797,31 +2818,29 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
StringRef BFloat16ExcessPrecision = "";
LangOptions::ComplexRangeKind Range = LangOptions::ComplexRangeKind::CX_None;
std::string ComplexRangeStr;
- std::string GccRangeComplexOption;
- std::string LastComplexRangeOption;
-
- auto setComplexRange = [&](LangOptions::ComplexRangeKind NewRange) {
- // Warn if user expects to perform full implementation of complex
- // multiplication or division in the presence of nnan or ninf flags.
- if (Range != NewRange)
- EmitComplexRangeDiag(D,
- !GccRangeComplexOption.empty()
- ? GccRangeComplexOption
- : ComplexArithmeticStr(Range),
- ComplexArithmeticStr(NewRange));
+ StringRef LastComplexRangeOption;
+
+ auto setComplexRange = [&](StringRef NewOption,
+ LangOptions::ComplexRangeKind NewRange) {
+ // Warn if user overrides the previously set complex number
+ // multiplication/division option.
+ if (Range != LangOptions::ComplexRangeKind::CX_None && Range != NewRange)
+ EmitComplexRangeDiag(D, LastComplexRangeOption, Range, NewOption,
+ NewRange);
+ LastComplexRangeOption = NewOption;
Range = NewRange;
};
// Lambda to set fast-math options. This is also used by -ffp-model=fast
- auto applyFastMath = [&](bool Aggressive) {
+ auto applyFastMath = [&](bool Aggressive, StringRef CallerOption) {
if (Aggressive) {
HonorINFs = false;
HonorNaNs = false;
- setComplexRange(LangOptions::ComplexRangeKind::CX_Basic);
+ setComplexRange(CallerOption, LangOptions::ComplexRangeKind::CX_Basic);
} else {
HonorINFs = true;
HonorNaNs = true;
- setComplexRange(LangOptions::ComplexRangeKind::CX_Promoted);
+ setComplexRange(CallerOption, LangOptions::ComplexRangeKind::CX_Promoted);
}
MathErrno = false;
AssociativeMath = true;
@@ -2873,54 +2892,18 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
default: continue;
case options::OPT_fcx_limited_range:
- if (GccRangeComplexOption.empty()) {
- if (Range != LangOptions::ComplexRangeKind::CX_Basic)
- EmitComplexRangeDiag(D, renderComplexRangeOption(Range),
- "-fcx-limited-range");
- } else {
- if (GccRangeComplexOption != "-fno-cx-limited-range")
- EmitComplexRangeDiag(D, GccRangeComplexOption, "-fcx-limited-range");
- }
- GccRangeComplexOption = "-fcx-limited-range";
- LastComplexRangeOption = A->getSpelling();
- Range = LangOptions::ComplexRangeKind::CX_Basic;
+ setComplexRange(A->getSpelling(),
+ LangOptions::ComplexRangeKind::CX_Basic);
break;
case options::OPT_fno_cx_limited_range:
- if (GccRangeComplexOption.empty()) {
- EmitComplexRangeDiag(D, renderComplexRangeOption(Range),
- "-fno-cx-limited-range");
- } else {
- if (GccRangeComplexOption != "-fcx-limited-range" &&
- GccRangeComplexOption != "-fno-cx-fortran-rules")
- EmitComplexRangeDiag(D, GccRangeComplexOption,
- "-fno-cx-limited-range");
- }
- GccRangeComplexOption = "-fno-cx-limited-range";
- LastComplexRangeOption = A->getSpelling();
- Range = LangOptions::ComplexRangeKind::CX_Full;
+ setComplexRange(A->getSpelling(), LangOptions::ComplexRangeKind::CX_Full);
break;
case options::OPT_fcx_fortran_rules:
- if (GccRangeComplexOption.empty())
- EmitComplexRangeDiag(D, renderComplexRangeOption(Range),
- "-fcx-fortran-rules");
- else
- EmitComplexRangeDiag(D, GccRangeComplexOption, "-fcx-fortran-rules");
- GccRangeComplexOption = "-fcx-fortran-rules";
- LastComplexRangeOption = A->getSpelling();
- Range = LangOptions::ComplexRangeKind::CX_Improved;
+ setComplexRange(A->getSpelling(),
+ LangOptions::ComplexRangeKind::CX_Improved);
break;
case options::OPT_fno_cx_fortran_rules:
- if (GccRangeComplexOption.empty()) {
- EmitComplexRangeDiag(D, renderComplexRangeOption(Range),
- "-fno-cx-fortran-rules");
- } else {
- if (GccRangeComplexOption != "-fno-cx-limited-range")
- EmitComplexRangeDiag(D, GccRangeComplexOption,
- "-fno-cx-fortran-rules");
- }
- GccRangeComplexOption = "-fno-cx-fortran-rules";
- LastComplexRangeOption = A->getSpelling();
- Range = LangOptions::ComplexRangeKind::CX_Full;
+ setComplexRange(A->getSpelling(), LangOptions::ComplexRangeKind::CX_Full);
break;
case options::OPT_fcomplex_arithmetic_EQ: {
LangOptions::ComplexRangeKind RangeVal;
@@ -2938,25 +2921,7 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
<< A->getSpelling() << Val;
break;
}
- if (!GccRangeComplexOption.empty()) {
- if (GccRangeComplexOption != "-fcx-limited-range") {
- if (GccRangeComplexOption != "-fcx-fortran-rules") {
- if (RangeVal != LangOptions::ComplexRangeKind::CX_Improved)
- EmitComplexRangeDiag(D, GccRangeComplexOption,
- ComplexArithmeticStr(RangeVal));
- } else {
- EmitComplexRangeDiag(D, GccRangeComplexOption,
- ComplexArithmeticStr(RangeVal));
- }
- } else {
- if (RangeVal != LangOptions::ComplexRangeKind::CX_Basic)
- EmitComplexRangeDiag(D, GccRangeComplexOption,
- ComplexArithmeticStr(RangeVal));
- }
- }
- LastComplexRangeOption =
- Args.MakeArgString(A->getSpelling() + A->getValue());
- Range = RangeVal;
+ setComplexRange(Args.MakeArgString(A->getSpelling() + Val), RangeVal);
break;
}
case options::OPT_ffp_model_EQ: {
@@ -2984,19 +2949,20 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
<< Args.MakeArgString("-ffp-model=" + Val);
if (Val == "fast") {
FPModel = Val;
- applyFastMath(false);
+ applyFastMath(false, Args.MakeArgString(A->getSpelling() + Val));
// applyFastMath sets fp-contract="fast"
LastFpContractOverrideOption = "-ffp-model=fast";
} else if (Val == "aggressive") {
FPModel = Val;
- applyFastMath(true);
+ applyFastMath(true, Args.MakeArgString(A->getSpelling() + Val));
// applyFastMath sets fp-contract="fast"
LastFpContractOverrideOption = "-ffp-model=aggressive";
} else if (Val == "precise") {
FPModel = Val;
FPContract = "on";
LastFpContractOverrideOption = "-ffp-model=precise";
- setComplexRange(LangOptions::ComplexRangeKind::CX_Full);
+ setComplexRange(Args.MakeArgString(A->getSpelling() + Val),
+ LangOptions::ComplexRangeKind::CX_Full);
} else if (Val == "strict") {
StrictFPModel = true;
FPExceptionBehavior = "strict";
@@ -3005,11 +2971,11 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
LastFpContractOverrideOption = "-ffp-model=strict";
TrappingMath = true;
RoundingFPMath = true;
- setComplexRange(LangOptions::ComplexRangeKind::CX_Full);
+ setComplexRange(Args.MakeArgString(A->getSpelling() + Val),
+ LangOptions::ComplexRangeKind::CX_Full);
} else
D.Diag(diag::err_drv_unsupported_option_argument)
<< A->getSpelling() << Val;
- LastComplexRangeOption = A->getSpelling();
break;
}
@@ -3194,8 +3160,7 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
continue;
[[fallthrough]];
case options::OPT_ffast_math:
- applyFastMath(true);
- LastComplexRangeOption = A->getSpelling();
+ applyFastMath(true, A->getSpelling());
if (A->getOption().getID() == options::OPT_Ofast)
LastFpContractOverrideOption = "-Ofast";
else
@@ -3213,15 +3178,12 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
ApproxFunc = false;
SignedZeros = true;
restoreFPContractState();
- // If the last specified option related to complex range is not
- // -ffast-math or -ffp-model=, emit warning.
- if (LastComplexRangeOption != "-ffast-math" &&
- LastComplexRangeOption != "-ffp-model=" &&
- Range != LangOptions::ComplexRangeKind::CX_Full)
- EmitComplexRangeDiag(D, LastComplexRangeOption, "-fno-fast-math");
- Range = LangOptions::ComplexRangeKind::CX_None;
+ if (Range != LangOptions::ComplexRangeKind::CX_Full)
+ setComplexRange(A->getSpelling(),
+ LangOptions::ComplexRangeKind::CX_None);
+ else
+ Range = LangOptions::ComplexRangeKind::CX_None;
LastComplexRangeOption = "";
- GccRangeComplexOption = "";
LastFpContractOverrideOption = "";
break;
} // End switch (A->getOption().getID())
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index a21f89da55009..98230e4d19bda 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -3518,6 +3518,9 @@ std::string tools::complexRangeKindToStr(LangOptions::ComplexRangeKind Range) {
case LangOptions::ComplexRangeKind::CX_Promoted:
return "promoted";
break;
+ case LangOptions::ComplexRangeKind::CX_None:
+ return "none";
+ break;
default:
return "";
}
diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index 57e16e8795a28..627592e808d78 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -54,11 +54,13 @@
// fpfast: -funsafe-math-optimizations
// fpfast: -ffast-math
-// RUN: %clang_cl /fp:fast /fp:precise -### -- %s 2>&1 | FileCheck -check-prefix=fpprecise %s
+// RUN: %clang_cl /fp:fast /fp:precise -Wno-overriding-complex-range -### -- %s 2>&1 | \
+// RUN: FileCheck -check-prefix=fpprecise %s
// fpprecise-NOT: -funsafe-math-optimizations
// fpprecise-NOT: -ffast-math
-// RUN: %clang_cl /fp:fast /fp:strict -### -- %s 2>&1 | FileCheck -check-prefix=fpstrict %s
+// RUN: %clang_cl /fp:fast /fp:strict -Wno-overriding-complex-range -### -- %s 2>&1 | \
+// RUN: FileCheck -check-prefix=fpstrict %s
// fpstrict-NOT: -funsafe-math-optimizations
// fpstrict-NOT: -ffast-math
// fpstrict: -ffp-contract=off
diff --git a/clang/test/Driver/fp-model.c b/clang/test/Driver/fp-model.c
index 6f17d4aeb1ef5..9cf5d0c53b24b 100644
--- a/clang/test/Driver/fp-model.c
+++ b/clang/test/Driver/fp-model.c
@@ -81,8 +81,7 @@
// WARN12: warning: overriding '-ffp-model=strict' option with '-Ofast'
// RUN: %clang -### -ffast-math -ffp-model=strict -c %s 2>&1 | FileCheck \
-// RUN: --check-prefix=WARN-CX-BASIC-TO-FULL %s
-// WARN-CX-BASIC-TO-FULL: warning: overriding '-fcomplex-arithmetic=basic' option with '-fcomplex-arithmetic=full'
+// RUN: --check-prefix=CHECK-FASTMATH-FPM-STRICT %s
// RUN: %clang -### -ffp-model=strict -fapprox-func -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=WARN13 %s
@@ -205,7 +204,7 @@
// RUN: %clang -### -nostdinc -ffast-math -ffp-model=fast -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-FASTMATH-FPM-FAST %s
-// CHECK-FASTMATH-FPM-FAST: warning: overriding '-fcomplex-arithmetic=basic' option with '-fcomplex-arithmetic=promoted'
+// CHECK-FASTMATH-FPM-FAST: warning: '-ffp-model=fast' sets complex range to "promoted" overriding the setting of "basic" that was implied by '-ffast-math'
// CHECK-FASTMATH-FPM-FAST: "-cc1"
// CHECK-FASTMATH-FPM-FAST-NOT: "-menable-no-infs"
// CHECK-FASTMATH-FPM-FAST-NOT: "-menable-no-nans"
@@ -221,7 +220,8 @@
// CHECK-FASTMATH-FPM-FAST-SAME: "-complex-range=promoted"
// RUN: %clang -### -nostdinc -ffast-math -ffp-model=precise -c %s 2>&1 \
-// RUN: | FileCheck --check-prefixes=CHECK-FASTMATH-FPM-PRECISE,WARN-CX-BASIC-TO-FULL %s
+// RUN: | FileCheck --check-prefixes=CHECK-FASTMATH-FPM-PRECISE %s
+// CHECK-FASTMATH-FPM-PRECISE: warning: '-ffp-model=precise' sets complex range to "full" overriding the setting of "basic" that was implied by '-ffast-math'
// CHECK-FASTMATH-FPM-PRECISE: "-cc1"
// CHECK-FASTMATH-FPM-PRECISE-NOT: "-menable-no-infs"
// CHECK-FASTMATH-FPM-PRECISE-NOT: "-menable-no-nans"
@@ -237,7 +237,8 @@
// CHECK-FASTMATH-FPM-PRECISE-SAME: "-complex-range=full"
// RUN: %clang -### -nostdinc -ffast-math -ffp-model=strict -c %s 2>&1 \
-// RUN: | FileCheck --check-prefixes=CHECK-FASTMATH-FPM-STRICT,WARN-CX-BASIC-TO-FULL %s
+// RUN: | FileCheck --check-prefixes=CHECK-FASTMATH-FPM-STRICT %s
+// CHECK-FASTMATH-FPM-STRICT: warning: '-ffp-model=strict' sets complex range to "full" overriding the setting of "basic" that was implied by '-ffast-math'
// CHECK-FASTMATH-FPM-STRICT: "-cc1"
// CHECK-FASTMATH-FPM-STRICT-NOT: "-menable-no-infs"
// CHECK-FASTMATH-FPM-STRICT-NOT: "-menable-no-nans"
diff --git a/clang/test/Driver/range-wanings.c b/clang/test/Driver/range-wanings.c
new file mode 100644
index 0000000000000..368ac03f579c3
--- /dev/null
+++ b/clang/test/Driver/range-wanings.c
@@ -0,0 +1,605 @@
+// Test overriding warnings about complex range.
+// range.c tests the settings of -complex-range=, and this test covers
+// all warnings related to complex range.
+
+// Clang options related to complex range are as follows:
+// -f[no-]fast-math
+// -f[no-]cx-limited-range
+// -f[no-]cx-fortran-rules
+// -fcomplex-arithmetic=[full|improved|promoted|basic]
+// -ffp-model=[strict|precise|fast|aggressive]
+
+// Emit warnings about overriding when options implying different
+// complex ranges are specified. However, warnings are not emitted in
+// the following cases:
+// (a) When the positive/negative form or a different value of the same
+// option is specified.
+// Example:
+// `-ffast-math -fno-fast-math`
+// `-fcx-limited-range -fno-cx-limited-range`
+// `-fcx-fortran-rules -fno-cx-fortran-rules`
+// `-fcomplex-arithmetic=full -fcomplex-arithmetic=improved`
+// `-ffp-model=strict -ffp-model=aggressive`
+//
+// (b) When -ffp-model= is negated by -fno-fast-math.
+// Example:
+// `-ffp-model=fast -fno-fast-math`
+
+
+// RUN: %clang -### -Werror -ffast-math -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -ffast-math -fcx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffast-math -fno-cx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOLIM-OVERRIDING,FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -ffast-math -fcx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FORT-OVERRIDING,FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -ffast-math -fno-cx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOFORT-OVERRIDING,FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -ffast-math -fcomplex-arithmetic=full -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-FULL-OVERRIDING,FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -ffast-math -fcomplex-arithmetic=improved -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-IMPROVED-OVERRIDING,FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -ffast-math -fcomplex-arithmetic=promoted -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-PROMOTED-OVERRIDING,FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -ffast-math -fcomplex-arithmetic=basic -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffast-math -ffp-model=strict -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-STRICT-OVERRIDING,FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -ffast-math -ffp-model=precise -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-PRECISE-OVERRIDING,FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -ffast-math -ffp-model=fast -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-FAST-OVERRIDING,FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -ffast-math -ffp-model=aggressive -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-fast-math -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-fast-math -fcx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-fast-math -fno-cx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-fast-math -fcx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-fast-math -fno-cx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-fast-math -fcomplex-arithmetic=full -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-fast-math -fcomplex-arithmetic=improved -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-fast-math -fcomplex-arithmetic=promoted -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-fast-math -fcomplex-arithmetic=basic -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-fast-math -ffp-model=strict -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-fast-math -ffp-model=precise -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-fast-math -ffp-model=fast -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-fast-math -ffp-model=aggressive -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fcx-limited-range -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fcx-limited-range -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOFAST-OVERRIDING,LIM-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fcx-limited-range -fno-cx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fcx-limited-range -fcx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FORT-OVERRIDING,LIM-OVERRIDDEN %s
+
+// RUN: %clang -### -fcx-limited-range -fno-cx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOFORT-OVERRIDING,LIM-OVERRIDDEN %s
+
+// RUN: %clang -### -fcx-limited-range -fcomplex-arithmetic=full -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-FULL-OVERRIDING,LIM-OVERRIDDEN %s
+
+// RUN: %clang -### -fcx-limited-range -fcomplex-arithmetic=improved -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-IMPROVED-OVERRIDING,LIM-OVERRIDDEN %s
+
+// RUN: %clang -### -fcx-limited-range -fcomplex-arithmetic=promoted -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-PROMOTED-OVERRIDING,LIM-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fcx-limited-range -fcomplex-arithmetic=basic -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fcx-limited-range -ffp-model=strict -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-STRICT-OVERRIDING,LIM-OVERRIDDEN %s
+
+// RUN: %clang -### -fcx-limited-range -ffp-model=precise -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-PRECISE-OVERRIDING,LIM-OVERRIDDEN %s
+
+// RUN: %clang -### -fcx-limited-range -ffp-model=fast -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-FAST-OVERRIDING,LIM-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fcx-limited-range -ffp-model=aggressive -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fno-cx-limited-range -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FAST-OVERRIDING,NOLIM-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fno-cx-limited-range -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-cx-limited-range -fcx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fno-cx-limited-range -fcx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FORT-OVERRIDING,NOLIM-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fno-cx-limited-range -fno-cx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-cx-limited-range -fcomplex-arithmetic=full -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fno-cx-limited-range -fcomplex-arithmetic=improved -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-IMPROVED-OVERRIDING,NOLIM-OVERRIDDEN %s
+
+// RUN: %clang -### -fno-cx-limited-range -fcomplex-arithmetic=promoted -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-PROMOTED-OVERRIDING,NOLIM-OVERRIDDEN %s
+
+// RUN: %clang -### -fno-cx-limited-range -fcomplex-arithmetic=basic -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-BASIC-OVERRIDING,NOLIM-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fno-cx-limited-range -ffp-model=strict -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-cx-limited-range -ffp-model=precise -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fno-cx-limited-range -ffp-model=fast -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-FAST-OVERRIDING,NOLIM-OVERRIDDEN %s
+
+// RUN: %clang -### -fno-cx-limited-range -ffp-model=aggressive -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-AGGRESSIVE-OVERRIDING,NOLIM-OVERRIDDEN %s
+
+// RUN: %clang -### -fcx-fortran-rules -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FAST-OVERRIDING,FORT-OVERRIDDEN %s
+
+// RUN: %clang -### -fcx-fortran-rules -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOFAST-OVERRIDING,FORT-OVERRIDDEN %s
+
+// RUN: %clang -### -fcx-fortran-rules -fcx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=LIM-OVERRIDING,FORT-OVERRIDDEN %s
+
+// RUN: %clang -### -fcx-fortran-rules -fno-cx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOLIM-OVERRIDING,FORT-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fcx-fortran-rules -fno-cx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fcx-fortran-rules -fcomplex-arithmetic=full -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-FULL-OVERRIDING,FORT-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fcx-fortran-rules -fcomplex-arithmetic=improved -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fcx-fortran-rules -fcomplex-arithmetic=promoted -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-PROMOTED-OVERRIDING,FORT-OVERRIDDEN %s
+
+// RUN: %clang -### -fcx-fortran-rules -fcomplex-arithmetic=basic -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-BASIC-OVERRIDING,FORT-OVERRIDDEN %s
+
+// RUN: %clang -### -fcx-fortran-rules -ffp-model=strict -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-STRICT-OVERRIDING,FORT-OVERRIDDEN %s
+
+// RUN: %clang -### -fcx-fortran-rules -ffp-model=precise -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-PRECISE-OVERRIDING,FORT-OVERRIDDEN %s
+
+// RUN: %clang -### -fcx-fortran-rules -ffp-model=fast -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-FAST-OVERRIDING,FORT-OVERRIDDEN %s
+
+// RUN: %clang -### -fcx-fortran-rules -ffp-model=aggressive -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-AGGRESSIVE-OVERRIDING,FORT-OVERRIDDEN %s
+
+// RUN: %clang -### -fno-cx-fortran-rules -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FAST-OVERRIDING,NOFORT-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fno-cx-fortran-rules -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fno-cx-fortran-rules -fcx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=LIM-OVERRIDING,NOFORT-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fno-cx-fortran-rules -fno-cx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-cx-fortran-rules -fcx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-cx-fortran-rules -fcomplex-arithmetic=full -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fno-cx-fortran-rules -fcomplex-arithmetic=improved -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-IMPROVED-OVERRIDING,NOFORT-OVERRIDDEN %s
+
+// RUN: %clang -### -fno-cx-fortran-rules -fcomplex-arithmetic=promoted -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-PROMOTED-OVERRIDING,NOFORT-OVERRIDDEN %s
+
+// RUN: %clang -### -fno-cx-fortran-rules -fcomplex-arithmetic=basic -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-BASIC-OVERRIDING,NOFORT-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fno-cx-fortran-rules -ffp-model=strict -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fno-cx-fortran-rules -ffp-model=precise -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fno-cx-fortran-rules -ffp-model=fast -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-FAST-OVERRIDING,NOFORT-OVERRIDDEN %s
+
+// RUN: %clang -### -fno-cx-fortran-rules -ffp-model=aggressive -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-AGGRESSIVE-OVERRIDING,NOFORT-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=full -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FAST-OVERRIDING,ARITH-FULL-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=full -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=full -fcx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=LIM-OVERRIDING,ARITH-FULL-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=full -fno-cx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=full -fcx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FORT-OVERRIDING,ARITH-FULL-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=full -fno-cx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=full -fcomplex-arithmetic=improved -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=full -fcomplex-arithmetic=promoted -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=full -fcomplex-arithmetic=basic -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=full -ffp-model=strict -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=full -ffp-model=precise -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=full -ffp-model=fast -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-FAST-OVERRIDING,ARITH-FULL-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=full -ffp-model=aggressive -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-AGGRESSIVE-OVERRIDING,ARITH-FULL-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=improved -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FAST-OVERRIDING,ARITH-IMPROVED-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=improved -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOFAST-OVERRIDING,ARITH-IMPROVED-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=improved -fcx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=LIM-OVERRIDING,ARITH-IMPROVED-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=improved -fno-cx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOLIM-OVERRIDING,ARITH-IMPROVED-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=improved -fcx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=improved -fno-cx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOFORT-OVERRIDING,ARITH-IMPROVED-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=improved -fcomplex-arithmetic=full -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=improved -fcomplex-arithmetic=promoted -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=improved -fcomplex-arithmetic=basic -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=improved -ffp-model=strict -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-STRICT-OVERRIDING,ARITH-IMPROVED-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=improved -ffp-model=precise -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-PRECISE-OVERRIDING,ARITH-IMPROVED-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=improved -ffp-model=fast -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-FAST-OVERRIDING,ARITH-IMPROVED-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=improved -ffp-model=aggressive -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-AGGRESSIVE-OVERRIDING,ARITH-IMPROVED-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=promoted -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FAST-OVERRIDING,ARITH-PROMOTED-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=promoted -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOFAST-OVERRIDING,ARITH-PROMOTED-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=promoted -fcx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=LIM-OVERRIDING,ARITH-PROMOTED-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=promoted -fno-cx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOLIM-OVERRIDING,ARITH-PROMOTED-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=promoted -fcx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FORT-OVERRIDING,ARITH-PROMOTED-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=promoted -fno-cx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOFORT-OVERRIDING,ARITH-PROMOTED-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=promoted -fcomplex-arithmetic=full -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=promoted -fcomplex-arithmetic=improved -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=promoted -fcomplex-arithmetic=basic -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=promoted -ffp-model=strict -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-STRICT-OVERRIDING,ARITH-PROMOTED-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=promoted -ffp-model=precise -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-PRECISE-OVERRIDING,ARITH-PROMOTED-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=promoted -ffp-model=fast -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=promoted -ffp-model=aggressive -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-AGGRESSIVE-OVERRIDING,ARITH-PROMOTED-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=basic -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=basic -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOFAST-OVERRIDING,ARITH-BASIC-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=basic -fcx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=basic -fno-cx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOLIM-OVERRIDING,ARITH-BASIC-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=basic -fcx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FORT-OVERRIDING,ARITH-BASIC-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=basic -fno-cx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOFORT-OVERRIDING,ARITH-BASIC-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=basic -fcomplex-arithmetic=full -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=basic -fcomplex-arithmetic=improved -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=basic -fcomplex-arithmetic=promoted -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=basic -ffp-model=strict -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-STRICT-OVERRIDING,ARITH-BASIC-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=basic -ffp-model=precise -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-PRECISE-OVERRIDING,ARITH-BASIC-OVERRIDDEN %s
+
+// RUN: %clang -### -fcomplex-arithmetic=basic -ffp-model=fast -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=MODEL-FAST-OVERRIDING,ARITH-BASIC-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -fcomplex-arithmetic=basic -ffp-model=aggressive -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=strict -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FAST-OVERRIDING,MODEL-STRICT-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -ffp-model=strict -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=strict -fcx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=LIM-OVERRIDING,MODEL-STRICT-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -ffp-model=strict -fno-cx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=strict -fcx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FORT-OVERRIDING,MODEL-STRICT-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -ffp-model=strict -fno-cx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -ffp-model=strict -fcomplex-arithmetic=full -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=strict -fcomplex-arithmetic=improved -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-IMPROVED-OVERRIDING,MODEL-STRICT-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=strict -fcomplex-arithmetic=promoted -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-PROMOTED-OVERRIDING,MODEL-STRICT-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=strict -fcomplex-arithmetic=basic -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-BASIC-OVERRIDING,MODEL-STRICT-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=strict -ffp-model=precise -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=strict -ffp-model=fast -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=strict -ffp-model=aggressive -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=precise -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FAST-OVERRIDING,MODEL-PRECISE-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -ffp-model=precise -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=precise -fcx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=LIM-OVERRIDING,MODEL-PRECISE-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -ffp-model=precise -fno-cx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=precise -fcx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FORT-OVERRIDING,MODEL-PRECISE-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -ffp-model=precise -fno-cx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -ffp-model=precise -fcomplex-arithmetic=full -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=precise -fcomplex-arithmetic=improved -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-IMPROVED-OVERRIDING,MODEL-PRECISE-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=precise -fcomplex-arithmetic=promoted -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-PROMOTED-OVERRIDING,MODEL-PRECISE-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=precise -fcomplex-arithmetic=basic -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-BASIC-OVERRIDING,MODEL-PRECISE-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=precise -ffp-model=strict -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=precise -ffp-model=fast -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=precise -ffp-model=aggressive -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=fast -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FAST-OVERRIDING,MODEL-FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -ffp-model=fast -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=fast -fcx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=LIM-OVERRIDING,MODEL-FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=fast -fno-cx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOLIM-OVERRIDING,MODEL-FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=fast -fcx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FORT-OVERRIDING,MODEL-FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=fast -fno-cx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOFORT-OVERRIDING,MODEL-FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=fast -fcomplex-arithmetic=full -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-FULL-OVERRIDING,MODEL-FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=fast -fcomplex-arithmetic=improved -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-IMPROVED-OVERRIDING,MODEL-FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -ffp-model=fast -fcomplex-arithmetic=promoted -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=fast -fcomplex-arithmetic=basic -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-BASIC-OVERRIDING,MODEL-FAST-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=fast -ffp-model=strict -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=fast -ffp-model=precise -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=fast -ffp-model=aggressive -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -ffp-model=aggressive -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -ffp-model=aggressive -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -Werror -ffp-model=aggressive -fcx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=aggressive -fno-cx-limited-range -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOLIM-OVERRIDING,MODEL-AGGRESSIVE-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=aggressive -fcx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=FORT-OVERRIDING,MODEL-AGGRESSIVE-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=aggressive -fno-cx-fortran-rules -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NOFORT-OVERRIDING,MODEL-AGGRESSIVE-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=aggressive -fcomplex-arithmetic=full -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-FULL-OVERRIDING,MODEL-AGGRESSIVE-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=aggressive -fcomplex-arithmetic=improved -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-IMPROVED-OVERRIDING,MODEL-AGGRESSIVE-OVERRIDDEN %s
+
+// RUN: %clang -### -ffp-model=aggressive -fcomplex-arithmetic=promoted -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=ARITH-PROMOTED-OVERRIDING,MODEL-AGGRESSIVE-OVERRIDDEN %s
+
+// RUN: %clang -### -Werror -ffp-model=aggressive -fcomplex-arithmetic=basic -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=aggressive -ffp-model=strict -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=aggressive -ffp-model=precise -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+// RUN: %clang -### -ffp-model=aggressive -ffp-model=fast -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
+
+
+// NO-OVR-WARN-NOT: [-Woverriding-complex-range]
+
+// FAST-OVERRIDING: warning: '-ffast-math' sets complex range to "basic"
+// NOFAST-OVERRIDING: warning: '-fno-fast-math' sets complex range to "none"
+// LIM-OVERRIDING: warning: '-fcx-limited-range' sets complex range to "basic"
+// NOLIM-OVERRIDING: warning: '-fno-cx-limited-range' sets complex range to "full"
+// FORT-OVERRIDING: warning: '-fcx-fortran-rules' sets complex range to "improved"
+// NOFORT-OVERRIDING: warning: '-fno-cx-fortran-rules' sets complex range to "full"
+// ARITH-FULL-OVERRIDING: warning: '-fcomplex-arithmetic=full' sets complex range to "full"
+// ARITH-IMPROVED-OVERRIDING: warning: '-fcomplex-arithmetic=improved' sets complex range to "improved"
+// ARITH-PROMOTED-OVERRIDING: warning: '-fcomplex-arithmetic=promoted' sets complex range to "promoted"
+// ARITH-BASIC-OVERRIDING: warning: '-fcomplex-arithmetic=basic' sets complex range to "basic"
+// MODEL-STRICT-OVERRIDING: warning: '-ffp-model=strict' sets complex range to "full"
+// MODEL-PRECISE-OVERRIDING: warning: '-ffp-model=precise' sets complex range to "full"
+// MODEL-FAST-OVERRIDING: warning: '-ffp-model=fast' sets complex range to "promoted"
+// MODEL-AGGRESSIVE-OVERRIDING: warning: '-ffp-model=aggressive' sets complex range to "basic"
+
+// FAST-OVERRIDDEN: overriding the setting of "basic" that was implied by '-ffast-math' [-Woverriding-complex-range]
+// LIM-OVERRIDDEN: overriding the setting of "basic" that was implied by '-fcx-limited-range' [-Woverriding-complex-range]
+// NOLIM-OVERRIDDEN: overriding the setting of "full" that was implied by '-fno-cx-limited-range' [-Woverriding-complex-range]
+// FORT-OVERRIDDEN: overriding the setting of "improved" that was implied by '-fcx-fortran-rules' [-Woverriding-complex-range]
+// NOFORT-OVERRIDDEN: overriding the setting of "full" that was implied by '-fno-cx-fortran-rules' [-Woverriding-complex-range]
+// ARITH-FULL-OVERRIDDEN: overriding the setting of "full" that was implied by '-fcomplex-arithmetic=full' [-Woverriding-complex-range]
+// ARITH-IMPROVED-OVERRIDDEN: overriding the setting of "improved" that was implied by '-fcomplex-arithmetic=improved' [-Woverriding-complex-range]
+// ARITH-PROMOTED-OVERRIDDEN: overriding the setting of "promoted" that was implied by '-fcomplex-arithmetic=promoted' [-Woverriding-complex-range]
+// ARITH-BASIC-OVERRIDDEN: overriding the setting of "basic" that was implied by '-fcomplex-arithmetic=basic' [-Woverriding-complex-range]
+// MODEL-STRICT-OVERRIDDEN: overriding the setting of "full" that was implied by '-ffp-model=strict' [-Woverriding-complex-range]
+// MODEL-PRECISE-OVERRIDDEN: overriding the setting of "full" that was implied by '-ffp-model=precise' [-Woverriding-complex-range]
+// MODEL-FAST-OVERRIDDEN: overriding the setting of "promoted" that was implied by '-ffp-model=fast' [-Woverriding-complex-range]
+// MODEL-AGGRESSIVE-OVERRIDDEN: overriding the setting of "basic" that was implied by '-ffp-model=aggressive' [-Woverriding-complex-range]
diff --git a/clang/test/Driver/range.c b/clang/test/Driver/range.c
index 30140f3c208e0..bcad88ec6ecb8 100644
--- a/clang/test/Driver/range.c
+++ b/clang/test/Driver/range.c
@@ -6,12 +6,6 @@
// RUN: %clang -### -target x86_64 -fno-cx-limited-range -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=FULL %s
-// RUN: %clang -### -target x86_64 -fcx-limited-range -fcx-fortran-rules \
-// RUN: -c %s 2>&1 | FileCheck --check-prefix=WARN1 %s
-
-// RUN: %clang -### -target x86_64 -fno-cx-limited-range -fcx-fortran-rules \
-// RUN: -c %s 2>&1 | FileCheck --check-prefix=WARN2 %s
-
// RUN: %clang -### -target x86_64 -fcx-limited-range -fno-cx-limited-range \
// RUN: -c %s 2>&1 | FileCheck --check-prefix=FULL %s
@@ -24,9 +18,6 @@
// RUN: %clang -### -target x86_64 -fno-cx-fortran-rules -fno-cx-limited-range \
// RUN: -c %s 2>&1 | FileCheck --check-prefix=FULL %s
-// RUN: %clang -### -target x86_64 -fcx-limited-range -fno-cx-fortran-rules \
-// RUN: -c %s 2>&1 | FileCheck --check-prefix=WARN4 %s
-
// RUN: %clang -### -target x86_64 -fcx-fortran-rules -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=IMPRVD %s
@@ -36,25 +27,12 @@
// RUN: %clang -### -target x86_64 -fcx-fortran-rules -c %s 2>&1 \
// RUN: -fno-cx-fortran-rules | FileCheck --check-prefix=FULL %s
-// RUN: %clang -### -target x86_64 -fcx-fortran-rules -fno-cx-limited-range \
-// RUN: -c %s 2>&1 | FileCheck --check-prefix=WARN3 %s
-
// RUN: %clang -### -target x86_64 -fno-cx-fortran-rules -c %s 2>&1 \
// RUN: | FileCheck %s
-// RUN: %clang -### -target x86_64 -fcx-limited-range -fcx-fortran-rules \
-// RUN: -c %s 2>&1 | FileCheck --check-prefix=WARN1 %s
-
-// RUN: %clang -### -target x86_64 -fcx-limited-range -fno-cx-fortran-rules \
-// RUN: -c %s 2>&1 | FileCheck --check-prefix=WARN4 %s
-
// RUN: %clang -### -target x86_64 -fcx-limited-range -fno-cx-limited-range \
// RUN: -c %s 2>&1 | FileCheck --check-prefix=FULL %s
-// RUN: %clang -### -target x86_64 -fcx-fortran-rules \
-// RUN: -fcx-limited-range -c %s 2>&1 \
-// RUN: | FileCheck --check-prefix=WARN20 %s
-
// RUN: %clang -### -target x86_64 -ffast-math -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=BASIC %s
@@ -90,14 +68,6 @@
// RUN: -fcomplex-arithmetic=improved -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=IMPRVD %s
-// RUN: %clang -### -target x86_64 -fcx-limited-range \
-// RUN: -fcomplex-arithmetic=improved -c %s 2>&1 \
-// RUN: | FileCheck --check-prefix=WARN6 %s
-
-// RUN: %clang -### -target x86_64 -fcx-fortran-rules \
-// RUN: -fcomplex-arithmetic=basic -c %s 2>&1 \
-// RUN: | FileCheck --check-prefix=WARN7 %s
-
// RUN: %clang -### -target x86_64 -fcomplex-arithmetic=basic \
// RUN: -fcomplex-arithmetic=full -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=FULL %s
@@ -123,10 +93,6 @@
// RUN: -fcomplex-arithmetic=basic -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=BASIC %s
-// RUN: %clang -### -target x86_64 -fcomplex-arithmetic=promoted \
-// RUN: -fcx-limited-range -c %s 2>&1 \
-// RUN: | FileCheck --check-prefix=WARN14 %s
-
// RUN: %clang -### -target x86_64 -fcomplex-arithmetic=promoted \
// RUN: -fcomplex-arithmetic=improved -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=IMPRVD %s
@@ -139,9 +105,6 @@
// RUN: -fcomplex-arithmetic=basic -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=BASIC %s
-// RUN: %clang -### -target x86_64 -fcomplex-arithmetic=full \
-// RUN: -ffast-math -c %s 2>&1 | FileCheck --check-prefix=WARN17 %s
-
// RUN: %clang -### -target x86_64 -fcomplex-arithmetic=full \
// RUN: -fcomplex-arithmetic=improved -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=IMPRVD %s
@@ -178,13 +141,13 @@
// RUN: | FileCheck --check-prefix=BASIC %s
// RUN: %clang -### --target=x86_64 -fcx-limited-range -fno-fast-math \
-// RUN: -c %s 2>&1 | FileCheck --check-prefixes=RANGE,WARN21 %s
+// RUN: -c %s 2>&1 | FileCheck --check-prefixes=RANGE %s
// RUN: %clang -### -Werror --target=x86_64 -fno-cx-limited-range -fno-fast-math \
// RUN: -c %s 2>&1 | FileCheck --check-prefixes=RANGE %s
// RUN: %clang -### --target=x86_64 -fcx-fortran-rules -fno-fast-math \
-// RUN: -c %s 2>&1 | FileCheck --check-prefixes=RANGE,WARN22 %s
+// RUN: -c %s 2>&1 | FileCheck --check-prefixes=RANGE %s
// RUN: %clang -### -Werror --target=x86_64 -fno-cx-fortran-rules -fno-fast-math \
// RUN: -c %s 2>&1 | FileCheck --check-prefixes=RANGE %s
@@ -193,13 +156,13 @@
// RUN: -c %s 2>&1 | FileCheck --check-prefixes=RANGE %s
// RUN: %clang -### --target=x86_64 -fcomplex-arithmetic=basic -fno-fast-math \
-// RUN: -c %s 2>&1 | FileCheck --check-prefixes=RANGE,WARN23 %s
+// RUN: -c %s 2>&1 | FileCheck --check-prefixes=RANGE %s
// RUN: %clang -### --target=x86_64 -fcomplex-arithmetic=promoted -fno-fast-math \
-// RUN: -c %s 2>&1 | FileCheck --check-prefixes=RANGE,WARN24 %s
+// RUN: -c %s 2>&1 | FileCheck --check-prefixes=RANGE %s
// RUN: %clang -### --target=x86_64 -fcomplex-arithmetic=improved -fno-fast-math \
-// RUN: -c %s 2>&1 | FileCheck --check-prefixes=RANGE,WARN25 %s
+// RUN: -c %s 2>&1 | FileCheck --check-prefixes=RANGE %s
// RUN: %clang -### -Werror --target=x86_64 -fcomplex-arithmetic=full -fno-fast-math \
// RUN: -c %s 2>&1 | FileCheck --check-prefixes=RANGE %s
@@ -255,22 +218,6 @@
// RUN: %clang -### -Werror --target=x86_64 -fno-fast-math -ffp-model=strict \
// RUN: -c %s 2>&1 | FileCheck --check-prefixes=FULL %s
-// WARN1: warning: overriding '-fcx-limited-range' option with '-fcx-fortran-rules' [-Woverriding-option]
-// WARN2: warning: overriding '-fno-cx-limited-range' option with '-fcx-fortran-rules' [-Woverriding-option]
-// WARN3: warning: overriding '-fcx-fortran-rules' option with '-fno-cx-limited-range' [-Woverriding-option]
-// WARN4: warning: overriding '-fcx-limited-range' option with '-fno-cx-fortran-rules' [-Woverriding-option]
-// WARN5: warning: overriding '-fcomplex-arithmetic=basic' option with '-fcomplex-arithmetic=improved' [-Woverriding-option]
-// WARN6: warning: overriding '-fcx-limited-range' option with '-fcomplex-arithmetic=improved' [-Woverriding-option]
-// WARN7: warning: overriding '-fcx-fortran-rules' option with '-fcomplex-arithmetic=basic' [-Woverriding-option]
-// WARN14: overriding '-complex-range=promoted' option with '-fcx-limited-range' [-Woverriding-option]
-// WARN17: warning: overriding '-fcomplex-arithmetic=full' option with '-fcomplex-arithmetic=basic' [-Woverriding-option]
-// WARN20: warning: overriding '-fcx-fortran-rules' option with '-fcx-limited-range' [-Woverriding-option]
-// WARN21: warning: overriding '-fcx-limited-range' option with '-fno-fast-math' [-Woverriding-option]
-// WARN22: warning: overriding '-fcx-fortran-rules' option with '-fno-fast-math' [-Woverriding-option]
-// WARN23: warning: overriding '-fcomplex-arithmetic=basic' option with '-fno-fast-math' [-Woverriding-option]
-// WARN24: warning: overriding '-fcomplex-arithmetic=promoted' option with '-fno-fast-math' [-Woverriding-option]
-// WARN25: warning: overriding '-fcomplex-arithmetic=improved' option with '-fno-fast-math' [-Woverriding-option]
-
// BASIC: -complex-range=basic
// FULL: -complex-range=full
// PRMTD: -complex-range=promoted
>From 2c3dd5fa75242bcbb1c5f29395fbe4f7fd5e2661 Mon Sep 17 00:00:00 2001
From: s-watanabe314 <watanabe.shu-06 at fujitsu.com>
Date: Tue, 2 Sep 2025 16:03:24 +0900
Subject: [PATCH 2/4] Add case to avoid warning
---
clang/lib/Driver/ToolChains/Clang.cpp | 2 ++
clang/test/Driver/range-wanings.c | 13 +++++++------
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 81f1d2dbac349..8aec5beb3d2dd 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2743,6 +2743,7 @@ static void EmitComplexRangeDiag(const Driver &D, StringRef LastOpt,
// | -fcx-fortran-rules | -fno-cx-fortran-rules |
// | -fno-cx-fortran-rules | -fcx-fortran-rules |
// | -ffast-math | -fno-fast-math |
+ // | -ffp-model= | -ffast-math |
// | -ffp-model= | -fno-fast-math |
// | -ffp-model= | -ffp-model= |
// | -fcomplex-arithmetic= | -fcomplex-arithmetic= |
@@ -2752,6 +2753,7 @@ static void EmitComplexRangeDiag(const Driver &D, StringRef LastOpt,
(LastOpt == "-fcx-fortran-rules" && NewOpt == "-fno-cx-fortran-rules") ||
(LastOpt == "-fno-cx-fortran-rules" && NewOpt == "-fcx-fortran-rules") ||
(LastOpt == "-ffast-math" && NewOpt == "-fno-fast-math") ||
+ (LastOpt.starts_with("-ffp-model=") && NewOpt == "-ffast-math") ||
(LastOpt.starts_with("-ffp-model=") && NewOpt == "-fno-fast-math") ||
(LastOpt.starts_with("-ffp-model=") &&
NewOpt.starts_with("-ffp-model=")) ||
diff --git a/clang/test/Driver/range-wanings.c b/clang/test/Driver/range-wanings.c
index 368ac03f579c3..79650f84a5a32 100644
--- a/clang/test/Driver/range-wanings.c
+++ b/clang/test/Driver/range-wanings.c
@@ -21,9 +21,10 @@
// `-fcomplex-arithmetic=full -fcomplex-arithmetic=improved`
// `-ffp-model=strict -ffp-model=aggressive`
//
-// (b) When -ffp-model= is negated by -fno-fast-math.
+// (b) When -ffp-model= is overridden by -f[no-]fast-math.
// Example:
// `-ffp-model=fast -fno-fast-math`
+// `-ffp-model=strict -ffast-math`
// RUN: %clang -### -Werror -ffast-math -fno-fast-math -c %s 2>&1 \
@@ -417,7 +418,7 @@
// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
// RUN: %clang -### -ffp-model=strict -ffast-math -c %s 2>&1 \
-// RUN: | FileCheck --check-prefixes=FAST-OVERRIDING,MODEL-STRICT-OVERRIDDEN %s
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
// RUN: %clang -### -Werror -ffp-model=strict -fno-fast-math -c %s 2>&1 \
// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
@@ -455,8 +456,8 @@
// RUN: %clang -### -ffp-model=strict -ffp-model=aggressive -c %s 2>&1 \
// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
-// RUN: %clang -### -ffp-model=precise -ffast-math -c %s 2>&1 \
-// RUN: | FileCheck --check-prefixes=FAST-OVERRIDING,MODEL-PRECISE-OVERRIDDEN %s
+// RUN: %clang -### -Werror -ffp-model=precise -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
// RUN: %clang -### -Werror -ffp-model=precise -fno-fast-math -c %s 2>&1 \
// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
@@ -494,8 +495,8 @@
// RUN: %clang -### -ffp-model=precise -ffp-model=aggressive -c %s 2>&1 \
// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
-// RUN: %clang -### -ffp-model=fast -ffast-math -c %s 2>&1 \
-// RUN: | FileCheck --check-prefixes=FAST-OVERRIDING,MODEL-FAST-OVERRIDDEN %s
+// RUN: %clang -### -Werror -ffp-model=fast -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
// RUN: %clang -### -Werror -ffp-model=fast -fno-fast-math -c %s 2>&1 \
// RUN: | FileCheck --check-prefixes=NO-OVR-WARN %s
>From fc94c3ae3d6b9a09937da294d87a551fc97fa579 Mon Sep 17 00:00:00 2001
From: s-watanabe314 <watanabe.shu-06 at fujitsu.com>
Date: Fri, 5 Sep 2025 17:48:48 +0900
Subject: [PATCH 3/4] remove default label
---
clang/lib/Driver/ToolChains/CommonArgs.cpp | 2 --
1 file changed, 2 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 98230e4d19bda..a9214c96ead5e 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -3521,8 +3521,6 @@ std::string tools::complexRangeKindToStr(LangOptions::ComplexRangeKind Range) {
case LangOptions::ComplexRangeKind::CX_None:
return "none";
break;
- default:
- return "";
}
}
>From dfb0ba924aa4a898b0a7222957fed6e6c06f473c Mon Sep 17 00:00:00 2001
From: s-watanabe314 <watanabe.shu-06 at fujitsu.com>
Date: Thu, 11 Sep 2025 09:33:06 +0900
Subject: [PATCH 4/4] Fix typo in filename
---
clang/test/Driver/{range-wanings.c => range-warnings.c} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename clang/test/Driver/{range-wanings.c => range-warnings.c} (100%)
diff --git a/clang/test/Driver/range-wanings.c b/clang/test/Driver/range-warnings.c
similarity index 100%
rename from clang/test/Driver/range-wanings.c
rename to clang/test/Driver/range-warnings.c
More information about the cfe-commits
mailing list