This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Is "optimize" attribute on fndecl handled differently?


Filed as PR63401: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63401


> This is easy to see with a simple C test case:
> 
> //__attribute__ ((optimize("strength-reduce")))
> int foo (float x) { return __builtin_isnan(x); }
> 
> Compiled with -O3 -ffast-math, the isnan is simplified out (fast math means no NaNs). If you uncomment the attribute (chosen because itâs actually useless), and compile again with -O3 -ffast-math: the isnan test is not simplified any more. This is because the codepath through default_options_optimization() has overwritten the value of the flags handled in set_fast_math_flags(): flag_finite_math_only, flag_signed_zeros, flag_trapping_math and flag_unsafe_math_optimizations.
> 
> Iâm CCâing the maintainers who added the optimize attribute in the first place, as they might have an idea how to fix this. This is way beyond my league!
> 
> 
> Thanks Steven for your help!
> FX


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]