-----Original Message----- From: gpc-owner@gnu.de [mailto:gpc-owner@gnu.de]On Behalf Of J. David Bryan Sent: 10 November 2001 04:35 To: GNU Pascal List Subject: Re: Bug Report: goto bug
On 10 Nov 2001, at 1:45, John P.R. Archer wrote:
Sorry about this horrid use of gotos in the following nasty bit
of code but
it core dumps on Solaris 2.6...
As a point of reference, with:
Reading specs from E:\Programming\Pascal\i486-pc-mingw32msvc\2.95.3\specs gpc version 20010924, based on 2.95.3 20010315 (release)
I get:
level_1 level_2 level_3 goto 2 label 2 should not get here
Also:
[...]
begin (* level_2 code *) writeln( 'level_2' ) ; level_3 ; writeln( 'should not get here' ) ; return ;
2:
writeln( 'label 2' ) ;
end ; (* level_2 code *)
begin (* level_1 code *) writeln( 'level_1' ) ; level_2 ; writeln( 'should not get here' ) ; end ; (* level_1 code *)
...I cannot see why the level 1 "should not get here" should not be executed.
My fault I'm afraid. I wasn't on the list before, so John Archer submitted this for me. I did a slight change to my original bug source and, since it core dumped, I didn't spot the unhelpful writeln. The original source was:-
program bug1 (output);
procedure level_1 ; label 1;
procedure level_2 ;
procedure level_3 ; begin (* level_3 code *) writeln( 'level_3' ) ; writeln( 'goto 1' ) ; goto 1 ; writeln( 'should not get here1' ) ; end ; (* level_3 code *)
begin (* level_2 code *) writeln( 'level_2' ) ; level_3 ; writeln( 'should not get here2' ) ; end ; (* level_2 code *)
begin (* level_1 code *) writeln( 'level_1' ) ; level_2 ; writeln( 'should not get here' ) ;
1:
writeln( 'label 1' ) ; end ; (* level_1 code *)
begin level_1 ; end.
Following John's suggestion I used Sparc Pascal and the run gives:-
level_1 level_2 level_3 goto 1 label 1
but with GPC I compile using just:-
gpc bug1.pas
and the run gives:-
level_1 level_2 level_3 goto 1 Segmentation Fault(coredump)
I tried to find more with GDB but the output isn't much use:-
gdb a.out core GNU gdb 4.17 Copyright 1998 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"... Core was generated by `a.out'. Program terminated with signal 11, Segmentation Fault. Reading symbols from /usr/lib/libm.so.1...done. Reading symbols from /usr/lib/libc.so.1...done. Reading symbols from /usr/lib/libdl.so.1...done. Reading symbols from /usr/platform/SUNW,Ultra-1/lib/libc_psr.so.1...done. #0 0x178d8 in Level_3.5 () (gdb) where #0 0x178d8 in Level_3.5 () Cannot access memory at address 0xbf1.
It rather looks like the stack manipulation (or something) has got rather mucked up.
Just as a reminder:-
gpc -v Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.3/specs gpc version 20010924, based on 2.95.3 20010315 (release)
Cheers, Martin.