gpc crashes compiling the following (erroneous) program. It correctly detects the syntax error, and then crashes with the crash report following.
Enjoy, Peter.
program peterW;
function Doit( Integer(info): Integer ): Integer; begin end;
begin end.
Date/Time: 2005-07-06 16:57:46.808 +0800 OS Version: 10.4.1 (Build 8B15) Report Version: 3
Command: gpc1 Path: /Developer/Pascal/gpc-20050331/libexec/gcc/powerpc-apple-darwin8.1.0/3.4.3/gpc1 Parent: gpc [19291]
Version: ??? (???)
PID: 19293 Thread: 0
Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000004
Thread 0 Crashed: 0 gpc1 0x00003580 locations + 288 (parse.y:2364) 1 gpc1 0x00011a1c main_yyparse + 3648 (parse.c:8495) 2 gpc1 0x000c17c8 toplev_main + 1976 (toplev.c:1826) 3 gpc1 0x00002298 _start + 344 (crt.c:272) 4 gpc1 0x0000213c start + 60
Thread 0 crashed with PPC Thread State: srr0: 0x00003580 srr1: 0x0000f930 vrsave: 0x00000000 cr: 0x22000282 xer: 0x00000000 lr: 0x00003578 ctr: 0x00000001 r0: 0x00003578 r1: 0xbfffe6a0 r2: 0x00000000 r3: 0x42000000 r4: 0x40e011e0 r5: 0x00000002 r6: 0x40e027c8 r7: 0x0000011e r8: 0x00000001 r9: 0x000ebe54 r10: 0x00000023 r11: 0x40f02004 r12: 0x900060ac r13: 0x0033ad0c r14: 0x003455d8 r15: 0x00000001 r16: 0x0044bca8 r17: 0x0033a2fc r18: 0x00300be4 r19: 0x000001f2 r20: 0x00300be4 r21: 0x404cc268 r22: 0x0044346c r23: 0x404cc268 r24: 0xbfffe758 r25: 0x0044346c r26: 0x00000002 r27: 0x00000030 r28: 0x00000001 r29: 0xbfffe788 r30: 0x404cc268 r31: 0x0000346c
Binary Images Description: 0x1000 - 0x443fff gpc1 /Developer/Pascal/gpc-20050331/libexec/gcc/powerpc-apple-darwin8.1.0/3.4.3/gpc1 0x40b54000 - 0x40b5bfff libintl.3.dylib /usr/local/lib/libintl.3.dylib 0x8fe00000 - 0x8fe50fff dyld 43 /usr/lib/dyld 0x90000000 - 0x901a6fff libSystem.B.dylib /usr/lib/libSystem.B.dylib 0x901fe000 - 0x90202fff libmathCommon.A.dylib /usr/lib/system/libmathCommon.A.dylib 0x90727000 - 0x90800fff com.apple.CoreFoundation 6.4.1 (368.1) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x9084b000 - 0x9094dfff libicucore.A.dylib /usr/lib/libicucore.A.dylib 0x909a7000 - 0x90a2bfff libobjc.A.dylib /usr/lib/libobjc.A.dylib 0x90ae3000 - 0x90af5fff libauto.dylib /usr/lib/libauto.dylib 0x91d33000 - 0x91d53fff libmx.A.dylib /usr/lib/libmx.A.dylib 0x92c9b000 - 0x92d89fff libiconv.2.dylib /usr/lib/libiconv.2.dylib 0x93614000 - 0x9361cfff libgcc_s.1.dylib /usr/lib/libgcc_s.1.dylib
Model: PowerMac7,3, BootROM 5.1.8f7, 2 processors, PowerPC G5 (3.0), 2 GHz, 1.5 GB Graphics: GeForce FX 5200, GeForce FX 5200, AGP, 64 MB Memory Module: DIMM0/J11, 256 MB, DDR SDRAM, PC3200U-30330 Memory Module: DIMM1/J12, 256 MB, DDR SDRAM, PC3200U-30330 Memory Module: DIMM2/J13, 512 MB, DDR SDRAM, PC3200U-30330 Memory Module: DIMM3/J14, 512 MB, DDR SDRAM, PC3200U-30330 Modem: Jump, , V.92, Version 1.0, Network Service: Built-in Ethernet, Ethernet, en0 Serial ATA Device: ST3160023AS, 149.05 GB Parallel ATA Device: HL-DT-ST DVD-RW GWA-4082B, USB Device: CanoScan, Canon, Up to 12 Mb/sec, 500 mA USB Device: Hub, , Up to 12 Mb/sec, 500 mA USB Device: CF076, CF076, Up to 12 Mb/sec, 500 mA USB Device: Hub in Apple Pro Keyboard, Chicony, Up to 12 Mb/sec, 500 mA USB Device: Apple Optical USB Mouse, Logitech, Up to 1.5 Mb/sec, 100 mA USB Device: Apple Pro Keyboard, Chicony, Up to 12 Mb/sec, 250 mA USB Device: Studio Display, , Up to 1.5 Mb/sec, 500 mA
Peter N Lewis wrote:
gpc crashes compiling the following (erroneous) program. It correctly detects the syntax error, and then crashes with the crash report following.
program peterW;
function Doit( Integer(info): Integer ): Integer; begin end;
begin end.
Seems to be a Bison bug (uninitialized usage of yystack->yyerror_range[1]). I will investigate further and report to the Bison maintainers. Thanks for the report.
Frank
I wrote:
Peter N Lewis wrote:
gpc crashes compiling the following (erroneous) program. It correctly detects the syntax error, and then crashes with the crash report following.
program peterW;
function Doit( Integer(info): Integer ): Integer; begin end;
begin end.
Seems to be a Bison bug (uninitialized usage of yystack->yyerror_range[1]). I will investigate further and report to the Bison maintainers. Thanks for the report.
By a rather strange coincidence, one of the Bison maintainers, Paul Hilfinger, found the same bug just the next day, before I got around to writing a bug report. The patch he sent fixes your problem.
Attached is a patch to the generated parse.c file of GPC, and Paul Hilfinger's Bison patch (re-diffed by me for Bison 2.0). You'll need the latter if you ever build GPC from a minimal distribution or ever modify parse.y or apply a patch that does so. You do not have to rebuild Bison, you can apply the patch to the glr.c file installed in /usr/[local/]share/bison/ or wherever. If you want to build Bison yourself, apply the patch in <bison-source>/data/ before building.
Frank