GCC CVS: infinite recursion? in safe_from_p

tm tm@mail.kloo.net
Thu Jul 25 16:24:00 GMT 2002

version: CVS mainline
   Host: i386-linux
 target: sh-elf

When the file imdecode.i from stress-1.17 is compiled with the options:

-O2 -m4 

the compiler segfaults.

Running the compiler in a debugger with the testcase seems to 
indicate the compiler goes into an infinite recursion;

(xxgdb) run
 strtod strtol strtoul strtof strtold strtoq strtouq atof atoi atol atoq
random srandom initstate setstate mblen ustat __copysign __copysignl
__stat stat __lstat lstat __fstat fstat __mknod mknod ReadAVSImage
ReadBMPImage {GC 5365k -> 2169k} ReadCMYKImage {GC 5735k -> 2206k} {GC
5365k -> 2282k} ReadDCMImage {GC 7435k -> 4253k} {GC 5652k -> 4023k} {GC
5744k -> 4122k} ReadDPSImage ReadFAXImage ReadFITSImage {GC 5882k ->
3999k} {GC 5343k -> 3890k} ReadFPXImage ReadGIFImage {GC 5421k -> 3849k}
ReadGRADATIONImage {GC 5338k -> 3731k} ReadGRAYImage {GC 5364k -> 3775k}
ReadHDFImage ReadHISTOGRAMImage ReadICCImage ReadICONImage {GC 5325k ->
3969k} {GC 5353k -> 3925k} ReadImages ReadIPTCImage ReadJBIGImage
JPEGGetCharacter {GC 5340k -> 3651k} JPEGColorProfileHandler
JPEGCommentHandler JPEGEmitMessage JPEGErrorExit JPEGNewsProfileHandler
ReadJPEGImage {GC 5396k -> 3825k} EscapeParenthesis ReadLABELImage {GC
5364k -> 4067k} {GC 5346k -> 3937k} ReadLOGOImage
Program received signal SIGSEGV, Segmentation fault.
0x0816ac40 in safe_from_p (x=0x41504eb0, exp=0x412c2cbc, top_p=0) at

At this point, dumping a backtrace is extremely bad, because GDB itself
goes into an infinite loop attempting to dump the stack frames, and
becomes unresponsive:

(xxgdb) bt
#0  0x0816ac40 in safe_from_p (x=0x41504eb0, exp=0x412c2cbc, top_p=0)
#1  0x0816aca6 in safe_from_p (x=0x41504eb0...

Testcase is imdecode.i from stress-1.17. Source available on request.


More information about the Gcc-bugs mailing list