Article View: gnu.gcc.bug
Article #1911bug in m68k gcc 1.30
From: Tom Quinn
Date: Fri, 04 Nov 1988 14:46
Date: Fri, 04 Nov 1988 14:46
282 lines
10795 bytes
10795 bytes
The following code is compiled in correctly with the "-O
-fstrength-reduce" flags. This is gcc version 1.30 on a Sun 3/50
running SunOS 3.5.
The offending assembler is setting up a for loop:
L28:
.stabd 68,0,135
movel a6,d1
addl #-304,d1
movel d1,a6@(-316)
movel a6,d1
addl #-288,d1
movel d1,a6@(-320)
movel a6,d1
addl #-256,d1
movel d1,a6@(-324)
moveq #-32,d1
addl a6,d1
movel d1,a6@(-328)
moveq #-16,d1
addl a6,d1
movel d1,a6@(-332)
movel a6@(32),d4
negl d4
movel a6@(28),d3
negl d3
moveq #-64,d5
addl a6,d5
moveq #16,d1
addl d5,d1
movel d1,a6@(-336)
moveq #16,d6
lea a5@(16),a3
mulsl d6,d7 # d7 is not set before it is used here!!!!
movel d7,a6@(-340)
clrl d1
addl d1,a6@(-340)
jra L34
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 -S -g -v -O -fstrength-reduce -c milines.c
gcc version 1.30
/usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ -D__HAVE_68881__ -Dmc68020 milines.c /tmp/cca06828.cpp
GNU CPP version 1.30
/usr/local/lib/gcc-cc1 /tmp/cca06828.cpp -quiet -dumpbase milines.c -fstrength-reduce -g -O -version -o milines.s
GNU C version 1.30 (68k, MIT syntax) compiled by GNU C version 1.30.
The code:
------------------------------------------------------------------------
typedef struct _DrawInfo *DrawablePtr;
typedef struct _DrawInfo {
short type;
int depth;
unsigned long serialNumber;
} DrawableRec;
typedef struct _GC *GCPtr;
typedef struct _GC{
int lineWidth;
int lineStyle;
int capStyle;
int joinStyle;
} GC;
typedef struct _SppPoint {
double x, y;
} SppPointRec, *SppPointPtr;
extern SppPointRec miExtendSegment();
extern void miGetPts(), miRoundCap(), miOneSegWide();
static SppPointRec IntersectLines();
void
miMiter (pDraw, pGC, caps, npt, pPts, xOrg, yOrg)
DrawablePtr pDraw;
GCPtr pGC;
int caps;
int npt;
SppPointPtr pPts;
int xOrg, yOrg;
{
int width = (pGC->lineWidth ? pGC->lineWidth : 1);
SppPointRec PolyPoints[4], FirstEdge[3], Wedge[4];
SppPointRec p1, p2, p3, p4, p5, p6, p7, p8;
int edges_match, i,
capStyle = pGC->capStyle;
if(npt <= 2)
{
miOneSegWide(pDraw, pGC, npt, pPts, caps, xOrg, yOrg);
return;
}
miGetPts(pPts[0], pPts[1], &p1, &p2, &p3, &p4, width);
if ((((((pPts[0].x) - ( pPts[npt-1].x)) > 0.0 ? ((pPts[0].x) - ( pPts[npt-1].x)) : -((pPts[0].x) - ( pPts[npt-1].x))) <= 0.000001 ) && ((((pPts[0].y) - ( pPts[npt-1].y)) > 0.0 ? ((pPts[0].y) - ( pPts[npt-1].y)) : -((pPts[0].y) - ( pPts[npt-1].y))) <= 0.000001 ) ) )
{
edges_match = 1;
miGetPts(pPts[npt-2], pPts[npt-1], &p5, &p6, &p7, &p8, width);
PolyPoints[2] = IntersectLines(p3, p4, p7, p8);
PolyPoints[3] = IntersectLines(p6, p5, p1, p2);
if ((((PolyPoints[2]).x-( PolyPoints[3]).x)*((PolyPoints[2]).x-( PolyPoints[3]).x)+((PolyPoints[2]).y-( PolyPoints[3]).y)*((PolyPoints[2]).y-( PolyPoints[3]).y)) >
108.856472512142 * width * width)
{
if ((((p5).x-( pPts[0]).x)*((p5).x-( pPts[0]).x)+((p5).y-( pPts[0]).y)*((p5).y-( pPts[0]).y)) - (((PolyPoints[3]).x-( pPts[0]).x)*((PolyPoints[3]).x-( pPts[0]).x)+((PolyPoints[3]).y-( pPts[0]).y)*((PolyPoints[3]).y-( pPts[0]).y))
< 0.000001 )
{
FirstEdge[2] = pPts[0];
if ((((( pPts[0]).x - ( pPts[npt-2]).x) * (( pPts[1] ).y - ( pPts[0]).y) - (( pPts[1] ).x - ( pPts[0]).x) * (( pPts[0]).y - ( pPts[npt-2]).y)) > 0) )
{
FirstEdge[0] = p4;
FirstEdge[1] = p7;
miFillSppPoly(pDraw, pGC, 3, FirstEdge, -xOrg, -yOrg, 0.0, 0.0);
FirstEdge[0] = p6;
} else {
FirstEdge[0] = p6;
FirstEdge[1] = p1;
miFillSppPoly(pDraw, pGC, 3, FirstEdge, -xOrg, -yOrg, 0.0, 0.0);
FirstEdge[1] = p7;
}
PolyPoints[2] = p4;
PolyPoints[3] = p1;
} else {
if ((((( pPts[0]).x - ( pPts[npt-2]).x) * (( pPts[1] ).y - ( pPts[0]).y) - (( pPts[1] ).x - ( pPts[0]).x) * (( pPts[0]).y - ( pPts[npt-2]).y)) > 0) )
{
FirstEdge[0] = PolyPoints[3];
FirstEdge[1] = p7;
FirstEdge[2] = p4;
PolyPoints[2] = p4;
} else {
FirstEdge[0] = p6;
FirstEdge[1] = PolyPoints[2];
FirstEdge[2] = p1;
PolyPoints[3] = p1;
}
miFillSppPoly(pDraw, pGC, 3, FirstEdge, -xOrg, -yOrg, 0.0, 0.0);
}
} else {
if ((((p5).x-( pPts[0]).x)*((p5).x-( pPts[0]).x)+((p5).y-( pPts[0]).y)*((p5).y-( pPts[0]).y)) - (((PolyPoints[3]).x-( pPts[0]).x)*((PolyPoints[3]).x-( pPts[0]).x)+((PolyPoints[3]).y-( pPts[0]).y)*((PolyPoints[3]).y-( pPts[0]).y))
< 0.000001 )
{
if ((((((PolyPoints[3].x) - ( p5.x)) > 0.0 ? ((PolyPoints[3].x) - ( p5.x)) : -((PolyPoints[3].x) - ( p5.x))) <= 0.000001 ) && ((((PolyPoints[3].y) - ( p5.y)) > 0.0 ? ((PolyPoints[3].y) - ( p5.y)) : -((PolyPoints[3].y) - ( p5.y))) <= 0.000001 ) ) )
{
FirstEdge[0] = p6;
FirstEdge[1] = p7;
PolyPoints[3] = p1;
} else {
if ((((( pPts[0]).x - ( pPts[npt-2]).x) * (( pPts[1] ).y - ( pPts[0]).y) - (( pPts[1] ).x - ( pPts[0]).x) * (( pPts[0]).y - ( pPts[npt-2]).y)) > 0) )
{
Wedge[0] = p4;
Wedge[2] = p7;
Wedge[3] = PolyPoints[2];
} else {
Wedge[0] = p6;
Wedge[2] = p1;
Wedge[3] = PolyPoints[3];
}
Wedge[1] = pPts[0];
miFillSppPoly(pDraw, pGC, 4, Wedge, -xOrg, -yOrg, 0.0, 0.0);
FirstEdge[1] = p7;
FirstEdge[0] = p6;
PolyPoints[3] = p1;
PolyPoints[2] = p4;
}
} else {
FirstEdge[0] = PolyPoints[3];
FirstEdge[1] = PolyPoints[2];
}
}
}
else
{
edges_match = 0;
if (caps && capStyle == 3 )
{
pPts[0] = miExtendSegment(pPts[0], pPts[1], width/2);
miGetPts(pPts[0], pPts[1], &p1, &p2, &p3, &p4, width);
pPts[npt-1] = miExtendSegment(pPts[npt-1], pPts[npt-2], width/2);
}
else if (caps && capStyle == 2 )
{
miRoundCap(pDraw, pGC, pPts[0], pPts[1], p4, p1, 1 ,
xOrg, yOrg, 0.0, 0.0);
miGetPts(pPts[npt-1], pPts[npt-2], &p5, &p6, &p7, &p8, width);
miRoundCap(pDraw, pGC, pPts[npt-1], pPts[npt-2], p8, p5, 1 ,
xOrg, yOrg, 0.0, 0.0);
}
PolyPoints[3] = p1;
PolyPoints[2] = p4;
}
for (i = 1; i < (npt - 1); i++)
{
miGetPts(pPts[i], pPts[i+1], &p5, &p6, &p7, &p8, width);
PolyPoints[0] = PolyPoints[3];
PolyPoints[1] = PolyPoints[2];
PolyPoints[2] = IntersectLines(p4, p3, p7, p8);
PolyPoints[3] = IntersectLines(p2, p1, p5, p6);
if ((((PolyPoints[2]).x-( PolyPoints[3]).x)*((PolyPoints[2]).x-( PolyPoints[3]).x)+((PolyPoints[2]).y-( PolyPoints[3]).y)*((PolyPoints[2]).y-( PolyPoints[3]).y)) >
108.856472512142 * width * width)
{
if ((((p1).x-( pPts[i]).x)*((p1).x-( pPts[i]).x)+((p1).y-( pPts[i]).y)*((p1).y-( pPts[i]).y)) - (((PolyPoints[3]).x-( pPts[i]).x)*((PolyPoints[3]).x-( pPts[i]).x)+((PolyPoints[3]).y-( pPts[i]).y)*((PolyPoints[3]).y-( pPts[i]).y))
< 0.000001 )
{
PolyPoints[2] = p3;
PolyPoints[3] = p2;
miFillSppPoly(pDraw, pGC, 4, PolyPoints, -xOrg, -yOrg, 0.0, 0.0);
if ((((( pPts[i]).x - ( pPts[i-1]).x) * (( pPts[i+1] ).y - ( pPts[i]).y) - (( pPts[i+1] ).x - ( pPts[i]).x) * (( pPts[i]).y - ( pPts[i-1]).y)) > 0) )
{
PolyPoints[1] = p8;
PolyPoints[3] = pPts[i];
miFillSppPoly(pDraw, pGC, 3, &PolyPoints[1], -xOrg, -yOrg, 0.0, 0.0);
} else {
PolyPoints[1] = p5;
PolyPoints[2] = pPts[i];
miFillSppPoly(pDraw, pGC, 3, &PolyPoints[1], -xOrg, -yOrg, 0.0, 0.0);
}
PolyPoints[2] = p8;
PolyPoints[3] = p5;
} else {
if ((((( pPts[i]).x - ( pPts[i-1]).x) * (( pPts[i+1] ).y - ( pPts[i]).y) - (( pPts[i+1] ).x - ( pPts[i]).x) * (( pPts[i]).y - ( pPts[i-1]).y)) > 0) )
{
PolyPoints[2] = p3;
miFillSppPoly(pDraw, pGC, 4, PolyPoints, -xOrg, -yOrg, 0.0, 0.0);
PolyPoints[1] = p8;
miFillSppPoly(pDraw, pGC, 3, &PolyPoints[1], -xOrg, -yOrg, 0.0, 0.0);
PolyPoints[2] = p8;
} else {
PolyPoints[3] = p2;
miFillSppPoly(pDraw, pGC, 4, PolyPoints, -xOrg, -yOrg, 0.0, 0.0);
PolyPoints[1] = p5;
miFillSppPoly(pDraw, pGC, 3, &PolyPoints[1], -xOrg, -yOrg, 0.0, 0.0);
PolyPoints[3] = p5;
}
}
} else {
if ((((p1).x-( pPts[i]).x)*((p1).x-( pPts[i]).x)+((p1).y-( pPts[i]).y)*((p1).y-( pPts[i]).y)) - (((PolyPoints[3]).x-( pPts[i]).x)*((PolyPoints[3]).x-( pPts[i]).x)+((PolyPoints[3]).y-( pPts[i]).y)*((PolyPoints[3]).y-( pPts[i]).y))
< 0.000001 )
{
if ((((((PolyPoints[3].x) - ( p1.x)) > 0.0 ? ((PolyPoints[3].x) - ( p1.x)) : -((PolyPoints[3].x) - ( p1.x))) <= 0.000001 ) && ((((PolyPoints[3].y) - ( p1.y)) > 0.0 ? ((PolyPoints[3].y) - ( p1.y)) : -((PolyPoints[3].y) - ( p1.y))) <= 0.000001 ) ) )
{
PolyPoints[3] = p2;
miFillSppPoly(pDraw, pGC, 4, PolyPoints, -xOrg, -yOrg, 0.0, 0.0);
PolyPoints[3] = p5;
PolyPoints[2] = p8;
} else {
if ((((( pPts[i]).x - ( pPts[i-1]).x) * (( pPts[i+1] ).y - ( pPts[i]).y) - (( pPts[i+1] ).x - ( pPts[i]).x) * (( pPts[i]).y - ( pPts[i-1]).y)) > 0) )
{
Wedge[0] = p8;
Wedge[2] = p3;
Wedge[3] = PolyPoints[2];
} else {
Wedge[0] = p2;
Wedge[2] = p5;
Wedge[3] = PolyPoints[3];
}
Wedge[1] = pPts[i];
miFillSppPoly(pDraw, pGC, 4, Wedge, -xOrg, -yOrg, 0.0, 0.0);
PolyPoints[2] = p3;
PolyPoints[3] = p2;
miFillSppPoly(pDraw, pGC, 4, PolyPoints, -xOrg, -yOrg, 0.0, 0.0);
PolyPoints[3] = p5;
PolyPoints[2] = p8;
}
} else
miFillSppPoly(pDraw, pGC, 4, PolyPoints, -xOrg, -yOrg, 0.0, 0.0);
}
p1 = p5; p2 = p6; p3 = p7; p4 = p8;
}
PolyPoints[0] = PolyPoints[3];
PolyPoints[1] = PolyPoints[2];
if (edges_match)
{
PolyPoints[2] = FirstEdge[1];
PolyPoints[3] = FirstEdge[0];
}
else
{
miGetPts(pPts[npt-2], pPts[npt-1], &p5, &p6, &p7, &p8, width);
PolyPoints[2] = p7;
PolyPoints[3] = p6;
}
miFillSppPoly(pDraw, pGC, 4, PolyPoints, -xOrg, -yOrg, 0.0, 0.0);
}
Technical Details
Message-ID:
<8811041446.AA10745@moose.cita.utoronto.ca>Path:
arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!osu-cis!tut.cis.ohio-state.edu!moose.cita.utoronto.ca!trqShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!osu-cis!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.30 Message-ID: <8811041446.AA10745@moose.cita.utoronto.ca> Date: 4 Nov 88 14:46:33 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 281