Running the testsuite of GPC (gpc version 20050331, based on gcc-3.4.3) on x86_64_unknown-linux-gnu platform we got the same segmentation fault on both traptest modules (traptest.pas & trap2test.pas). It seems that on the trapexec mechanism dosn't work correctly. We got the same problem also on our application ported under gpc. Same suggestions to solve this problem?
Here, below, you find the problem report.
-bash-2.05b$ gpc -g -O3 -W -Wall --autobuild -o traptest.exe traptest.pas -bash-2.05b$ ./traptest.exe Segmentation fault -bash-2.05b$ gdb traptest.exe (gdb) run Starting program: /dkalvn46_1/grfdev/ags/gnu/gpc-20050331/p/test/traptest.exe
Program received signal SIGSEGV, Segmentation fault. $0000007fbffff010 in ?? () (gdb) where #0 $0000007fbffff010 in ?? () #1 $0000000000402ad9 in dosetjmp (p=$7fbffff010) at /dkalvn46_1/grfdev/local/lib/gcc/x86_64-unknown-linux-gnu/3.4.3/units/trapc. c:50 #2 $0000000000402c13 in _p__M4_Trap_S3_Trapexec (p=@$402e20) at /dkalvn46_1/grfdev/local/lib/gcc/x86_64-unknown-linux-gnu/3.4.3/units/trap.p as:173 #3 $0000000000402f2e in main program () at traptest.pas:25 #4 $0000000000402fdc in main (argc=0, argv=$0, envp=$7fbfffef20) at <implicit code>:31 (gdb)
*** traptest.pas ****
1 { Test of the Trap unit. } 2 program TrapTest; 3 uses Trap; 4 procedure Test (Trapped : Boolean); 5 var Counter : Integer = 0; attribute (static); 6 begin 7 if Trapped then 8 begin 9 Inc (Counter); 10 if Counter < 42 then 11 Write (Ln (0)) 12 else 13 Write ('K') 14 end 15 else 16 begin 17 Write ('O'); 18 Write (Ln (0)) 19 end 20 end; 21 begin 22 TrapExec (Test); 23 TrappedExitCode := 0; 24 TrappedErrorAddr := nil; 25 TrappedErrorMessageString := ''; 26 WriteLn 27 end.