senda <senda(a)ic.rdc.ricoh.co.jp> writes:
I found that
this is compiler optimization problem (egcs-1.0.2 on sparc solaris-2.5.1).
gcc -g -O search.c ... ---> no problem
gcc -g -O2 search.c ... ---> core-dumped by above operations.
This looks very much like a compiler bug. Egcs is pretty stable
within bounds on many platforms, I've compiled most of my development
system with Egcs/Pgcc of various versions. The usual method is to
read the documentation to find out what optimizations are enabled
between -O and -O2 and rebuilding with a certain optimization disabled
until you find the specific option that makes `gcc -g -O' work and
`gcc -g -O -f<Some-Optimization>' not work. Further help in this area
is beyond the scope of xemacs-beta, I urge you to seek help with the
Egcs folks.
You could try upgrading to Egcs-1.0.3a and see if that helps. I don't
know offhand whether any Sparc changes made it, I think egcs-1.0.2 ->
1.0.3 was all Linux/ix86 changes.
For whatever it's worth, even on Intel/Linux I found Egcs/Pgcc-1.02 to
be pretty stable at -O6 if the -fno-risc and -fno-peep-spills options
were also specified.