Null pointer dereference and side effects
Archie Cobbs
archie@dellroad.org
Tue Jul 20 15:30:00 GMT 2004
Eljay Love-Jensen wrote:
> You could try disabling or reviewing the optimizations one at a time, until
> you find a likely culprit...
Interestingly, I can turn all the "-f" flags off and it still doesn't
segfault. However, if I omit the "-O2" but turn all the "-f" flags on,
it always does segfault.
So the offending optimization appears to only depend on "-O2" and
not on any of the flags implied by -O2:
# GNU C version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (i386-redhat-linux)
# compiled by GNU C version 3.2.2 20030222 (Red Hat Linux 3.2.2-5).
# options passed: -fpreprocessed -O2 -Wall -fverbose-asm
# options enabled: -fdefer-pop -foptimize-sibling-calls -fcse-follow-jumps
# -fcse-skip-blocks -fexpensive-optimizations -fthread-jumps
# -fstrength-reduce -fpeephole -fforce-mem -ffunction-cse
# -fkeep-static-consts -fcaller-saves -fpcc-struct-return -fgcse -fgcse-lm
# -fgcse-sm -frerun-cse-after-loop -frerun-loop-opt
# -fdelete-null-pointer-checks -fschedule-insns2 -fsched-interblock
# -fsched-spec -fbranch-count-reg -freorder-blocks -fcprop-registers
# -fcommon -fverbose-asm -fgnu-linker -fregmove -foptimize-register-move
# -fargument-alias -fstrict-aliasing -fmerge-constants -fident -fpeephole2
# -fguess-branch-probability -fmath-errno -ftrapping-math -m80387
# -mhard-float -mno-soft-float -mieee-fp -mfp-ret-in-387 -mcpu=i386
# -march=i386
Thanks,
-Archie
__________________________________________________________________________
Archie Cobbs * CTO, Awarix * http://www.awarix.com
More information about the Gcc-help
mailing list