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.
I tried to diagnose at my best for a full week, but I am now totally lost.
However, I gathered some elements:
1- When I truss the program, I see it enters in an long loop of brk() calls
(malloc), until it crashes.
End of the truss:
brk(0x012D8410) = 0
brk(0x012D8410) = 0
brk(0x012DC410) = 0
brk(0x012DC410) = 0
brk(0x012E0410) = 0
brk(0x012E0410) = 0
brk(0x012E4410) = 0
brk(0x012E4410) = 0
brk(0x012EA410) = 0
brk(0x012EA410) = 0
brk(0x012EE410) = 0
Incurred fault #6, FLTBOUNDS %pc = 0x00019708
siginfo: SIGSEGV SEGV_MAPERR addr=0xEF7FE000
Received signal #11, SIGSEGV [default]
siginfo: SIGSEGV SEGV_MAPERR addr=0xEF7FE000
*** process killed ***
* Run the program under gdb:
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.6"...
(gdb) b main
Breakpoint 1 at $18060: file <implicit code>, line 5.
(gdb) r
Starting program: /data1/Pascal/tests/test1
Breakpoint 1, $00018060 in main (argc=1, argv=$effff964, envp=$effff96c) at
<implicit code>:5
5 <implicit code>: No such file or directory.
in <implicit code>
(gdb) s
Program received signal SIGSEGV, Segmentation fault.
_p__rts_Error_S34_Finisherrormessage (N=300) at
/data1/Pascal/gcc-3.4.3/gcc/p/rts/error.pas:887
887 s := ReturnAddr2Hex (ErrorAddr);
(gdb) p ErrorAddr
Address of symbol "Erroraddr" is unknown.
(gdb) l
882 begin
883 ExitCode := n;
884 ErrorAddr := CurrentReturnAddr;
885 CurrentReturnAddr := nil;
886 CurrentReturnAddrCounter := 0;
887 s := ReturnAddr2Hex (ErrorAddr);
888 {$local cstrings-as-strings}
889 { @@ stack problem } var
foo:CString;foo:=ErrorMessageString;WriteStr (ErrorMessageString, foo, '
(error #', n, ' at ', s, ')')
890 {$endlocal}
891 end;
(gdb) p ExitCode
Address of symbol "Exitcode" is unknown.
(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
gpc --verbose
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
gpc version 20050331, based on gcc-3.4.3
I use all the GNU packages suggested in the INSTALL file:
bison 1.27
flex 2.5.4a
make 3.75
patch 2.5.4
sed 3.02
except for binutils 2.10, that is not recommended with Solaris because of as
and ld replacements.
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.
Thanks in advance.
Pascal Viandier
pascal(a)accovia.com