Path: utzoo!telly!ddsw1!mcdchg!rutgers!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 sparc gcc 1.32 Message-ID: <8901062220.AA07053@moose.cita.utoronto.ca> Date: 6 Jan 89 22:20:35 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 137 The following code causes gcc to abort. This is gcc version 1.32 on a Sun 4/110 running SunOS 4.0. 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 -sun4 -c miarc.c gcc version 1.32 /usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__OPTIMIZE__ miarc.c /tmp/cca03569.cpp GNU CPP version 1.32 /usr/local/lib/gcc-cc1 /tmp/cca03569.cpp -quiet -dumpbase miarc.c -g -O -version -o /tmp/cca03569.s GNU C version 1.32 (sparc) compiled by GNU C version 1.32. gcc: Program cc1 got fatal signal 6. The code: ------------------------------------------------------------------------ computeAngleFromPath (startAngle, endAngle, w, h, lenp, backwards) int startAngle, endAngle; int *lenp; int backwards; { double len; double t0, t1, x0, y0, x1, y1, sidelen; int a, startq, endq, q; int a0, a1; a0 = startAngle; a1 = endAngle; len = *lenp; if (backwards) { a0 = (64 * 360) - a0; a1 = (64 * 360) - a1; } if (a1 < a0) a1 += (64 * 360) ; startq = floor ((double) a0 / (90.0 * 64.0)); endq = floor ((double) a1 / (90.0 * 64.0)); a = a0; a0 = a0 - startq * 90 *64; a1 = a1 - endq * 90 * 64; for (q = startq; q <= endq && len > 0; ++q) { if (q == startq && a0 != 0) { t0 = (((double) (a0 + startq * 90 * 64)) / 64.0 * 3.14159265358979323846 /180.0) ; x0 = (double) w / 2 * cos (t0); y0 = (double) h / 2* sin (t0); } else { x0 = 0; y0 = 0; switch (((q) >= 0 ? (q) % ( 4) : ( 4) - (-q) % ( 4)) ) { case 0: x0 = (double) w/2; break; case 2: x0 = - (double) w/2; break; case 1: y0 = (double) h/2; break; case 3: y0 = -(double) h/2; break; } } if (q == endq) { if (a1 == 0) { x1 = 0; y1 = 0; switch (((q) >= 0 ? (q) % ( 4) : ( 4) - (-q) % ( 4)) ) { case 0: x1 = (double) w/2; break; case 2: x1 = - (double) w/2; break; case 1: y1 = (double) h/2; break; case 3: y1 = -(double) h/2; break; } } else { t1 = (((double) (a1 + endq * 90 * 64)) / 64.0 * 3.14159265358979323846 /180.0) ; x1 = (double) w / 2 * cos(t1); y1 = (double) h / 2 * sin(t1); } } else { x1 = 0; y1 = 0; switch (((q) >= 0 ? (q) % ( 4) : ( 4) - (-q) % ( 4)) ) { case 0: y1 = (double) h/2; break; case 2: y1 = - (double) h/2; break; case 1: x1 = -(double) w/2; break; case 3: x1 = (double) w/2; break; } } sidelen = sqrt ((x1-x0)*(x1-x0) + (y1-y0) * (y1-y0)); if (sidelen >= len) { x1 = 0; y1 = 0; switch (((q) >= 0 ? (q) % ( 4) : ( 4) - (-q) % ( 4)) ) { case 0: y1 = (double) h/2; break; case 2: y1 = -(double) h/2; break; case 1: x1 = -(double) w/2; break; case 3: x1 = (double) w/2; break; } sidelen = sqrt ((x1-x0) * (x1-x0) + (y1-y0) * (y1-y0)); y1 = y0 + (y1 - y0) * len / sidelen; x1 = x0 + (x1 - x0) * len / sidelen; if (x1 == (double) w/2 && y1 == 0) a1 = 0; else if (x1 == -(double) w/2 && y1 == 0) a1 = 180 * 64; else if (y1 == (double) h/2 && x1 == 0) a1 = 90 * 64; else if (y1 == -(double) h/2 && x1 == 0) a1 = 270 * 64; else { if (w == 0) { t1 = asin (y1 / ((double) h/2)); switch (((q) >= 0 ? (q) % ( 4) : ( 4) - (-q) % ( 4)) ) { case 1: case 2: t1 = 3.14159265358979323846 - t1; } } else if (h == 0) { t1 = acos (x1 / ((double) w/2)); switch (((q) >= 0 ? (q) % ( 4) : ( 4) - (-q) % ( 4)) ) { case 2: case 3: t1 = 2 * 3.14159265358979323846 - t1; } } else { t1 = atan2 (y1 * w, x1 * h); } a1 = (t1 * 180/3.14159265358979323846 ) * 64.0; if (a1 < 0) a1 += (64 * 360) ; } a1 -= ((q) >= 0 ? (q) % ( 4) : ( 4) - (-q) % ( 4)) * 90 * 64; len = 0; } else len -= sidelen; } *lenp = len; a1 = a1 + (q-1) * (90*64); if (backwards) a1 = (64 * 360) - a1; return a1; }