Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -3006,9 +3006,6 @@ !JA.isOffloading(Action::OFK_HIP)) if (FPContract == "fast") { FPContract = "on"; - D.Diag(clang::diag::warn_drv_overriding_flag_option) - << "-ffp-contract=fast" - << "-ffp-contract=on"; } break; } Index: clang/test/Driver/fp-model.c =================================================================== --- clang/test/Driver/fp-model.c +++ clang/test/Driver/fp-model.c @@ -3,6 +3,8 @@ // // REQUIRES: clang-driver +// expected-no-diagnostics + // RUN: %clang -### -ffp-model=fast -ffp-contract=off -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=WARN %s // WARN: warning: overriding '-ffp-model=fast' option with '-ffp-contract=off' [-Woverriding-t-option] @@ -19,6 +21,13 @@ // RUN: | FileCheck --check-prefix=WARN3 %s // WARN3: warning: overriding '-ffp-model=strict' option with '-ffast-math' [-Woverriding-t-option] +// RUN: %clang -c -ffast-math -fno-fast-math -Xclang -verify %s 2>&1 +// RUN: %clang -c -fno-fast-math -ffast-math -Xclang -verify %s 2>&1 +// RUN: %clang -c -ffast-math -ffp-contract=on -Xclang -verify %s 2>&1 +// RUN: %clang -c -ffp-contract=on -ffast-math -Xclang -verify %s 2>&1 +// RUN: %clang -c -ffp-contract=on -ffp-model=fast -Xclang -verify %s 2>&1 +// RUN: %clang -c -ffp-model=fast -ffp-contract=on -Xclang -verify %s 2>&1 + // RUN: %clang -### -ffp-model=strict -ffinite-math-only -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=WARN4 %s // WARN4: warning: overriding '-ffp-model=strict' option with '-ffinite-math-only' [-Woverriding-t-option] @@ -63,6 +72,9 @@ // RUN: | FileCheck --check-prefix=WARNf %s // WARNf: warning: overriding '-ffp-model=strict' option with '-Ofast' [-Woverriding-t-option] +// RUN: %clang -c -Ofast -fno-fast-math -Xclang -verify %s 2>&1 +// RUN: %clang -c -fno-fast-math -Ofast -Xclang -verify %s 2>&1 + // RUN: %clang -### -ffp-model=strict -fdenormal-fp-math=preserve-sign,preserve-sign -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=WARN10 %s // WARN10: warning: overriding '-ffp-model=strict' option with '-fdenormal-fp-math=preserve-sign,preserve-sign' [-Woverriding-t-option] @@ -102,6 +114,9 @@ // CHECK-FPM-PRECISE: "-ffp-contract=on" // CHECK-FPM-PRECISE: "-fno-rounding-math" +// RUN: %clang -c -ffp-model=precise -ffp-contract=fast -Xclang -verify %s 2>&1 +// RUN: %clang -c -ffp-contract=fast -ffp-model=precise -Xclang -verify %s 2>&1 + // RUN: %clang -### -nostdinc -ffp-model=strict -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FPM-STRICT %s // CHECK-FPM-STRICT: "-cc1"