I have problems executing Pascal programs build from gpc-20050331.
I followed rigorously the directions of the INSTALL file, build and rebuild gcc and gpc many times, always ending with the same problem
The problem:
Even the simplest program you can think of produces a segmentation fault. However, the compilation and linking steps give no errors.
The sample program: program test1;
begin
end.
<snip>
(gdb) where #0 _p__rts_Error_S34_Finisherrormessage (N=300) at /data1/Pascal/gcc-3.4.3/gcc/p/rts/error.pas:887 Cannot access memory at address $ef7ff4dc (gdb) s
Program terminated with signal SIGSEGV, Segmentation fault. The program no longer exists. (gdb)
It is strange to see the program jumping right in the middle of the Finisherrormessage() function!
I cannot get more information, unless someone helps me.
Configuration:
Hardware: gcc-3.4.3 on a Sun Ultra5 with Solaris 2.6 with 384 Mb of RAM
Software: gcc -v Reading specs from /usr/local/lib/gcc/sparc-sun-solaris2.6/3.4.3/specs Configured with: ../gcc-3.4.3/configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --disable-nls --disable-libgcj --enable-languages=pascal,c,c++ Thread model: posix gcc version 3.4.3
<snip>
Help would be greatly appreciated since I have 450 000 lines of SUN Pascal to convert to GNU Pascal to make our applications platform-independent.
I belive it is a known problem. Hppa machines had similar problem (supurious range-check failure in leading to stack overflow).
The following should fix the problem:
--- p/rts/move.pas.orig 2005-05-06 19:24:26.188617784 +0000 +++ p/rts/move.pas 2005-05-06 18:43:23.418015824 +0000 @@ -58,6 +58,7 @@ PWords = ^TWords; PConstWords = ^const TWords;
+{$R-} function Merge (w1, w2: TWord; Shift1, Shift2: Integer): TWord; attribute (inline); begin if BytesBigEndian then @@ -66,7 +67,7 @@ Merge := (w1 shr Shift1) or (w2 shl Shift2) end;
-{$pointer-arithmetic,R-} +{$pointer-arithmetic}
procedure MoveLeft (const Source; var Dest; Count: SizeType); var