Waldek Hebisch wrote:
gpc-20030830 have a memory management bug which is probably responsible for crashes reported by Adriaan van Os and Maurice Lombardi. Mainly builds with gcc-3.3.x are affected (I do not know if it is possible to trigger the bug with earlier gcc version). The patch below fixes the problem:
Thanks for looking into this.
I tried the patch with gpc-20030830 and gcc-3.3.1. The string.pas unit now compiles, but I get what also seems a memory management related error.
../.././xgpc -B../.././ -c -I. -W -Wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -g -O2 --unit-path=/Users/adriaan/gnu/gpc-331d3/gcc/p/rts --automake `cat needed-options` -DRTS_RELEASE_STRING="'`cat /Users/adriaan/gnu/gpc-331d3/gcc/p/rts/rts-version`'" -DGCC_VERSION="'3.3.1'" /Users/adriaan/gnu/gpc-331d3/gcc/p/rts/string.pas ../.././xgpc -B../.././ -c -I. -W -Wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -g -O2 --unit-path=/Users/adriaan/gnu/gpc-331d3/gcc/p/rts --automake `cat needed-options` -DRTS_RELEASE_STRING="'`cat /Users/adriaan/gnu/gpc-331d3/gcc/p/rts/rts-version`'" -DGCC_VERSION="'3.3.1'" /Users/adriaan/gnu/gpc-331d3/gcc/p/rts/error.pas *** malloc[21421]: error for object 0xf400e0: Incorrect checksum for freed object - object was probably modified after being freed; break at szone_error /Users/adriaan/gnu/gpc-331d3/gcc/p/rts/error.pas: In procedure `DefaultSignalHandler': /Users/adriaan/gnu/gpc-331d3/gcc/p/rts/error.pas:1071: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See URL:http://gcc.gnu.org/bugs.html for instructions. make[2]: *** [error.o] Error 1 make[1]: *** [pascal.rts] Error 2 make: *** [all-gcc] Error 2
The backtrace reads as follows:
**********
Date/Time: 2003-09-07 21:39:07 +0200 OS Version: 10.2.4 (Build 6I32) Host: G4.local.
Command: gpc1 PID: 21421
Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_INVALID_ADDRESS (0x0001) at 0x26000004
Thread 0 Crashed: #0 0x000d1d20 in alloc_page (ggc-page.c:683) #1 0x000d0c70 in ggc_alloc (ggc-page.c:1026) #2 0x0013df00 in gen_rtx_fmt_ee (genrtl.c:37) #3 0x001c8db0 in simplify_plus_minus (simplify-rtx.c:1896) #4 0x001c57fc in simplify_gen_binary (simplify-rtx.c:129) #5 0x001dcf50 in find_best_addr (cse.c:3093) #6 0x001df678 in fold_rtx (cse.c:3600) #7 0x001dec9c in fold_rtx (cse.c:3794) #8 0x001e0d2c in cse_insn (cse.c:5106) #9 0x001e5afc in cse_basic_block (cse.c:7347) #10 0x001e5704 in cse_main (cse.c:7220) #11 0x000a57d4 in rest_of_compilation (toplev.c:2817) #12 0x00019310 in finish_routine (declarations.c:2530) #13 0x0000a784 in yyuserAction (parse.c:4581) #14 0x00013c38 in yydoAction (parse.c:8238) #15 0x00013700 in yyglrReduce (parse.c:8290) #16 0x000127e0 in main_yyparse (parse.c:8959) #17 0x000a4d8c in compile_file (toplev.c:2134) #18 0x000a9ff4 in do_compile (toplev.c:5384) #19 0x000aa0c0 in toplev_main (toplev.c:5414) #20 0x00002520 in _start (crt.c:267) #21 0x000023a0 in start
PPC Thread State: srr0: 0x000d1d20 srr1: 0x0200f930 vrsave: 0x00000000 xer: 0x20000000 lr: 0x000d1cb8 ctr: 0x00000000 mq: 0x00000000 r0: 0x2a000000 r1: 0xbfffcb00 r2: 0x24004282 r3: 0x26000000 r4: 0x00000004 r5: 0x0146dfc0 r6: 0x00000000 r7: 0x0146dfc0 r8: 0x00000047 r9: 0x0114a54b r10: 0x00000010 r11: 0x44044242 r12: 0x84042228 r13: 0xbfffcc80 r14: 0x00000000 r15: 0x00000002 r16: 0x00000004 r17: 0x00000001 r18: 0x00000001 r19: 0x00311cb8 r20: 0x00000000 r21: 0x00000022 r22: 0xbfffcc80 r23: 0x00000100 r24: 0x0000003c r25: 0x00310c1c r26: 0x00000004 r27: 0x00000088 r28: 0x00001000 r29: 0x00d16250 r30: 0x00000000 r31: 0x000d1cb8
Regards,
Adriaan van Os