[clang] [Clang][Driver] Override complex number calculation method by -fno-fast-math (PR #132680)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 3 13:15:21 PDT 2025


andykaylor wrote:

>  This test expects the warning message `warning: overriding '-fcomplex-arithmetic=basic' option with '-fcomplex-arithmetic=promoted'` for `clang -ffast-math -ffp-model=fast`. I'm not sure if this test is correct, but I believe a new variable is necessary to avoid affecting it. If we stored the history of non-Gcc options in the existing `GccComplexRangeOption`, the above warning message would become `overriding '-ffast-math' option with '-ffp-model=fast'`. Should I also fix all warnings related to complex range options other than `-fno-fast-math`?

I've never been happy with the way we handle the warnings where aggregate flags change the complex range setting. For instance, in the case you cite, `warning: overriding '-fcomplex-arithmetic=basic' option with '-fcomplex-arithmetic=promoted'`, that has to be confusing to a user who has used neither '-fcomplex-arithmetic=basic' nor '-fcomplex-arithmetic=promoted'. In a perfect world, the message would say `warning: '-fp-model=fast' sets complex range to "promoted" overriding the setting of "basic" that was implied by '-ffast-math'`. I'm just not sure how much logic we'd need to construct such a message with reasonable grammar in all cases.

I think we just need to commit to each change making progress relative to the previous state rather than trying to fix everything.

I'll give your changes a closer review tomorrow, but I think you're on the right track.

https://github.com/llvm/llvm-project/pull/132680


More information about the cfe-commits mailing list