The gcc-local man page, which documents local changes to the compiler has this to say.
The -O2 option does not include -fstrict-aliasing, as this option
causes issues on some legacy code. -fstrict-aliasing is very unsafe
with code that plays tricks with casts, bypassing the already weak
type system of C.
What does this mean and why should you care? The first part is easy to answer. Long ago, in the dark ages when legacy code was written, people used to write functions like this:
int *x = (int *)&f;
*x = 0x5f3759df - ( *x >> 1 );
The C standard clearly says that objects are not to be accessed through incompatible pointers, but people did it anyway. Fucking idiots.
As for why one should care about the default setting of the compiler, the best answer I can give is that if you’re in a position to care, you probably know more than enough to form your own opinion and don’t need me to explain it to you. Otherwise, nobody cares except to the extent it confirms one’s own biases.
The strict aliasing optimization is disabled in gcc 4.2 because it was disabled in gcc 3.3. It was disabled in gcc 3.3 because it was disabled in gcc 2.95. It was disabled in gcc 2.95 because it was the year 1999.
The gcc-local man page continues with even more stupid options.
The -O2 option does not include -fstrict-overflow, as this option
causes issues on some legacy code. -fstrict-overflow can cause
surprising optimizations to occur, possibly deleting security
critical overflow checks.
The Strict Aliasing Situation Is Pretty Bad.