Currently the options ‘ffast-math’ and ‘ffp-contract’ are connected.
When ‘ffast-math’ is set, ffp-contract is altered this way: -ffast-math/ Ofast -> ffp-contract=fast -fno-fast-math -> if ffp-contract= fast then ffp-contract=on else ffp-contract unchanged This differs from gcc which doesn’t connect the two options. Connecting these two options in clang, resulted in spurious warnings when the user combines these two options -ffast-math -fno-fast-math; see issue https://github.com/llvm/llvm-project/issues/54625. The issue is that the ‘ffast-math’ option is an on/off flag, but the ‘ffp-contract’ is an on/off/fast flag. So when ‘fno-fast-math’ is used there is no obvious value for ‘ffp-contract’. What should the value of ffp-contract be for -ffp-contract=fast -fno-fast-math and -ffast-math -ffp-contract=fast -fno-fast-math? The current logic sets ffp-contract back to on in these cases. This doesn’t take into account that the value of ffp-contract is modified by an explicit ffp-contract` option. This patch is proposing a set of rules to apply when ffp-contract', ffast-math and fno-fast-math are combined. These rules would give the user the expected behavior and no diagnostic would be needed. See RFC https://discourse.llvm.org/t/rfc-making-ffast-math-option-unrelated-to-ffp-contract-option/61912
Loading
Please sign in to comment