[clang] [Clang][Driver] Warn on complex number range incompatibility with GCC (PR #144468)
Shunsuke Watanabe via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 17 21:48:25 PDT 2025
================
@@ -520,6 +520,9 @@ def warn_drv_math_errno_enabled_after_veclib: Warning<
"math errno enabled by '%0' after it was implicitly disabled by '%1',"
" this may limit the utilization of the vector library">,
InGroup<MathErrnoEnabledWithVecLib>;
+def warn_drv_gcc_incompatible_complex_range_override: Warning<
+ "combination of '%0' and '%1' results in complex number calculations incompatible with GCC">,
----------------
s-watanabe314 wrote:
Thank you for the feedback! I agree that a user wouldn't know how to handle this warning just by seeing it. How about adding the following note diagnostic and outputting it along with the incompatibility warning?
`note: complex multiplication and division use different calculation methods than GCC. specify '%0' after '%1' for GCC compatibility`
Implementing this would result in the following output:
```
$ clang test.cpp -fcx-fortran-rules -fcx-limited-range
clang: warning: overriding '-fcx-fortran-rules' option with '-fcx-limited-range' [-Woverriding-option]
clang: warning: combination of '-fcx-fortran-rules' and '-fcx-limited-range' results in complex number calculations incompatible with GCC [-Wgcc-compat]
clang: note: complex multiplication and division use different calculation methods than GCC. specify '-fcx-fortran-rules' after '-fcx-limited-range' for GCC compatibility
```
https://github.com/llvm/llvm-project/pull/144468
More information about the cfe-commits
mailing list