Description of problem: #pragma GCC optimize("no-strict-aliasing") appears to have no effect, as aliasing warnings are still output when compiling a file with: #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) #pragma GCC optimize("no-strict-aliasing") #endif at the beginning. No warnings are issued about the pragma being ignored either. Version-Release number of selected component (if applicable): gcc-4.4.0-0.20 How reproducible: Always. Steps to Reproduce: 1. Try building kdelibs-4.2.0-12.fc11 or just look at the build logs from my build. Actual results: Aliasing warnings still present in kjs/dtoa.cpp. Expected results: No aliasing warnings in kjs/dtoa.cpp. Additional info: kdelibs-4.2.0-13.fc11 now simply adds -fno-strict-aliasing on the command line through CMake, which works, so this is not urgent for us, but it seems to indicate something being broken in the #pragma GCC optimize machinery.
That's not a bug, but feature. The ability to tweak strict-aliasing using optimize attribute/pragma lead to many ICEs and has been disabled on purpose, see http://gcc.gnu.org/PR37106. That said, just being lazy and using -fno-strict-aliasing is the wrong thing to do, much better is to actually look at the code and fix the bugs in it, submit upstream.
But should GCC not at least warn that the #pragma (or rather its value) is being ignored?