This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Null pointer dereference and side effects
Hi Archie,
You could try disabling or reviewing the optimizations one at a time, until
you find a likely culprit...
> gcc -fverbose-asm -save-temps -O2 -W -Wall crash.c
> cat crash.s
.file "crash.c"
! GNU C version 3.2 (sparc-sun-solaris2.8)
! compiled by GNU C version 3.2.
! options passed: -fpreprocessed -O2 -W -Wall -fverbose-asm
! options enabled: -fdefer-pop -fomit-frame-pointer
! -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 -fdelayed-branch -fgcse -fgcse-lm -fgcse-sm
! -frerun-cse-after-loop -frerun-loop-opt -fdelete-null-pointer-checks
! -fschedule-insns -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
.section ".text"
.align 4
.global main
.type main,#function
.proc 04
main:
!#PROLOGUE# 0
!#PROLOGUE# 1
retl
mov 1, %o0
.LLfe1:
.size main,.LLfe1-main
.ident "GCC: (GNU) 3.2"
HTH,
--Eljay