On the effect of #pragma STDC CX_LIMITED_RANGE ON


I am finding that using said pragma does not have the intended effect of disabling the C99 Annex G compliance that generates calls into the rather slow __mulsc3 and __muldc3 soft float library functions. This behavior was observed in Clang 11 and 10 (I did not test older revisions).

Allow me to link to godbolt to compare the generated code for this short code snippet:

std::complex f(std::complex x) {
return x*x;


I find that the #pragma does not remove the call into __mulsc3 in said example, whereas setting the flag -fno-honor-nans has the intended effect.

However I am worried that -fno-honor-nans would also affect code other than complex number arithmetic.

Would you maybe consider supporting the -fcx-limited-range compiler switch that is available in the GCC compiler?