Brian Dessent wrote:
Raymond Sheh wrote:
(and indeed, in one of the cases, if I manually put all
the optimisation flags mentioned in the manpage for -O1 and -O2 onto the
compile line it doesn't actually break!).
Specifying -fsome-optimization without an n >= 0 level of -On is a
no-op. In other words, optimization must be enabled in order to do any
optimization.
Brian
Hi Brian,
Thanks for the info, although I think there must be something I'm
missing ... with the little sample program I posted at the start (not
the big long one) for instance, the following compile commands exhibit
the problem (using GCC 4.1.3):
gcc -fstrict-aliasing -fschedule-insns test.c -o test; ./test
gcc -fstrict-aliasing -fschedule-insns -fexpensive-optimizations test.c
-o test; ./test
(and pretty much any combo I tried that included both -fstrict-aliasing
and -fschedule-insns and with or without -On, n in [0-3])
but I don't get the problem with:
gcc -fstrict-aliasing test.c -o test; ./test
gcc -O1 -fschedule-insns test.c -o test; ./test
(or any other combo I tried that doesn't go above -O1 and doesn't
include -fstrict-aliasing, or explicitly includes -fno-strict-aliasing)
This is all being tested on pretty much a standard Kubuntu 7.10 (Gutsy
Gibbon) install using the distro's GCC packages ... perhaps is there
some way of seeing what the defaults are set to? Is it possible that for
some reason some optimisation level (below -O1, if there is such a
thing) is enabled by default?
Cheers!
- Raymond