Nonlocal gotos on s390
Frank Heckenbach
frank@g-n-u.de
Sun Aug 31 15:39:00 GMT 2003
Gerhard Tonn wrote:
> Matthias Klose wrote:
> > Frank forwarded this to me.
> > Gerhard, please could you help/forward this to the s390 porters?
> >
> > Thanks, Matthias
> >
> >
> >>fjf558[m-p].pas
> >>fproc.pas
> >>goto5.pas
> >>nlgpp2.pas
> >>
> >
> >
> > Waldek Hebisch writes:
> >
> >>I played a little with Hercules and s390 Debian. I think I have
> >>found the reason for failures of nonlocal gotos. On s390 constants
> >>are stored in memory and accesed via a base register. Each
> >>function has its own "pool" of constants. Nonlocal gotos were
> >>not restoring the base register. It seems that the code to
> >>restore the base register is present, but "short-circuit" by
> >>an optimization.
>
> Uli Weigand, the main s390 backend maintainer, told me that your
> workaround is not correct. He is interested in a short example, if
> possible coded in C, that shows this misbehaviour you mention above.
> Since he is going on vacation for the next weeks, it would be helpful,
> if you could post it to the gcc mailing list so that somebody else could
> look into the problem.
frank@trex:~# uname -a
Linux trex 2.4.17 #1 SMP Thu Apr 3 08:58:03 UTC 2003 s390 unknown
frank@trex:~# gcc -v
Reading specs from /home/frank/usr/lib/gcc-lib/s390-ibm-linux/3.2.1/specs
Configured with: ../gcc-3.2.1/configure --enable-languages=pascal --prefix=/home/frank/usr
Thread model: posix
gcc version 3.2.1
frank@trex:~# cat goto5.c
#include <stdio.h>
static void foo ()
{
__label__ bar;
static void baz ()
{
puts ("OK 1");
goto bar;
puts ("failed 1");
}
baz ();
puts ("failed 2");
bar:
puts ("OK 2");
}
int main ()
{
foo ();
return 0;
}
frank@trex:~# gcc goto5.c
frank@trex:~# ./a.out
OK 1
Segmentation fault
Frank
--
Frank Heckenbach, frank@g-n-u.de
http://fjf.gnu.de/
GnuPG and PGP keys: http://fjf.gnu.de/plan (7977168E)
More information about the Gcc
mailing list