Article View: gnu.gcc.bug
Article #2241bug in m68k gcc 1.33
From: Tom Quinn
Date: Sat, 04 Feb 1989 22:26
Date: Sat, 04 Feb 1989 22:26
87 lines
3514 bytes
3514 bytes
The following code will cause gcc to abort when compiled with the "-g
-O" option. This is gcc version 1.33 on a Sun 3/50 running SunOS 3.5.
Tom Quinn Canadian Institute for Theoretical Astrophysics
trq@moose.cita.utoronto.ca
UUCP - decvax!utgpu!moose!trq
BITNET - quinn@utorphys.bitnet
ARPA - trq%moose.cita.toronto.edu@relay.cs.net
The compile:
gcc -g -v -O -c qmove.c
gcc version 1.33
/usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__OPTIMIZE__ -D__HAVE_68881__ -Dmc68020 qmove.c /tmp/cca13863.cpp
GNU CPP version 1.33
/usr/local/lib/gcc-cc1 /tmp/cca13863.cpp -quiet -dumpbase qmove.c -g -O -version -o /tmp/cca13863.s
GNU C version 1.33 (68k, MIT syntax) compiled by GNU C version 1.33.
gcc: Program cc1 got fatal signal 6.
The code:
------------------------------------------------------------------------
int
pen_x, pen_y,
level,
Speed;
bounds(x0, y0, x1, y1, dx0, dy0, dx1, dy1)
register int x0, y0, x1, y1;
register int *dx0, *dy0, *dx1, *dy1;
{
register int new_x0, new_y0, new_x1, new_y1;
int count, loop_count = 0;
if (!( random () % 10)) {
register int r;
r = random ();
*dx0 = (1 + r%(Speed-1)) * ((r&1) ? -1 : 1);
r = random ();
*dy0 = (1 + r%(Speed-1)) * ((r&1) ? -1 : 1);
r = random ();
*dx1 = (1 + r%(Speed-1)) * ((r&1) ? -1 : 1);
r = random ();
*dy1 = (1 + r%(Speed-1)) * ((r&1) ? -1 : 1);
if (level > -2 && !( random () % (6 - level))) {
if (pen_x - x0 > 0 && *dx0 < 0)
*dx0 = -*dx0;
if (pen_x - x1 > 0 && *dx1 < 0)
*dx1 = -*dx1;
if (pen_y - y0 > 0 && *dy0 < 0)
*dy0 = -*dy0;
if (pen_y - y1 > 0 && *dy1 < 0)
*dy1 = -*dy1;
}
}
do {
if (x0 + *dx0 <= 1 || x0 + *dx0 >= (( 700 - 2 * 10 )/ 5 ) -2)
*dx0 = -*dx0;
if (x1 + *dx1 <= 1 || x1 + *dx1 >= (( 700 - 2 * 10 )/ 5 ) -2)
*dx1 = -*dx1;
if (y0 + *dy0 <= 1 || y0 + *dy0 >= (( 750 - 10 - 25 )/ 5 ) -2)
*dy0 = -*dy0;
if (y1 + *dy1 <= 1 || y1 + *dy1 >= (( 750 - 10 - 25 )/ 5 ) -2)
*dy1 = -*dy1;
new_x0 = x0 + *dx0;
new_x1 = x1 + *dx1;
new_y0 = y0 + *dy0;
new_y1 = y1 + *dy1;
if ((abs(new_x1 - new_x0) > 45 ) || (abs((*dx0)-(*dx1)) < ((4+level)/3) ))
if ( random ()&1)
*dx1 += (x1<x0 ? (Speed) : - (Speed) ), new_x1 = x1 + *dx1;
else
*dx0 += (x0<x1 ? (Speed) : - (Speed) ), new_x0 = x0 + *dx0;
if ((abs(new_y1 - new_y0) > 45 ) || (abs((*dy0)-(*dy1)) < ((4+level)/3) ))
if ( random ()&1)
(*dy1) += (y1<y0 ? (Speed) : - (Speed) ), new_y1 = y1 + *dy1;
else
(*dy0) += (y0<y1 ? (Speed) : - (Speed) ), new_y0 = y0 + *dy0;
if ((count = check_line(new_x0, new_y0, new_x1, new_y1)) == 1) {
register int r;
*dx0 = (1 + (r = random ())%Speed) * ((r&1) ? -1 : 1);
*dy0 = (1 + (r = random ())%Speed) * ((r&1) ? -1 : 1);
*dx1 = (1 + (r = random ())%Speed) * ((r&1) ? -1 : 1);
*dy1 = (1 + (r = random ())%Speed) * ((r&1) ? -1 : 1);
}
if (!(++loop_count % 100)) {
break;
}
} while(count == 1);
return count;
}
Technical Details
Message-ID:
<8902042226.AA03087@moose.cita.utoronto.ca>Path:
arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!MOOSE.CITA.UTORONTO.CA!trqShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!MOOSE.CITA.UTORONTO.CA!trq From: trq@MOOSE.CITA.UTORONTO.CA (Tom Quinn) Newsgroups: gnu.gcc.bug Subject: bug in m68k gcc 1.33 Message-ID: <8902042226.AA03087@moose.cita.utoronto.ca> Date: 4 Feb 89 22:26:15 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 87