[gnu.gcc.bug] More fatal signals for sparc

schmidt%blanche.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt") (11/24/88)

Bug Report for GCC:
-------------------
Problem :  gcc 1.31 gets a fatal signal for the following program
	        when compiled with the -O -finline-functions 
           -fstrength-reduce options.

1.) Version : gcc 1.31
-----------

2.) Input Program :
-----------------

typedef struct _GC    *GCPtr;
char *alloca();
typedef struct _DDXPoint *DDXPointPtr;
typedef struct _DDXPoint {
    short x, y;
} DDXPointRec;
typedef struct _DrawInfo *DrawablePtr;	
typedef struct _GC{
    int		miTranslate:1;		 
    void (* FillSpans)();
} GC;
typedef struct _Window *WindowPtr;
typedef struct _DrawInfo {
    short	type;
} DrawableRec;
typedef struct _Window {
	DDXPointRec  absCorner;
} WindowRec;
typedef struct _SppPoint {
	double	x, y;
} SppPointRec, *SppPointPtr;
static int GetFPolyYBounds();
void
miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
    DrawablePtr 	dst;
    GCPtr		pgc;
    int			count;           
    SppPointPtr 	ptsIn;   
    int			xTrans, yTrans;
    double		xFtrans, yFtrans;
{
    double		xl, xr, ml, mr, dy, i;
    int			y, j, imin, ymin, ymax, *width, *FirstWidth, *Marked; 
    register int	left, right, nextleft, nextright;
    DDXPointPtr 	ptsOut,
    			FirstPoint;	 
    if (pgc->miTranslate && (dst->type == 0 ) )
    {
	xTrans += ((WindowPtr)dst)->absCorner.x;
	yTrans += ((WindowPtr)dst)->absCorner.y;
    }
    imin = GetFPolyYBounds(ptsIn, count, yFtrans, &ymin, &ymax);
    y = ymax - ymin + 1;
    ptsOut = FirstPoint = (DDXPointPtr)alloca((int)(sizeof(DDXPointRec) * y)) ;
    width = FirstWidth = (int *) alloca((int)(sizeof(int) * y)) ;
    Marked = (int *) alloca((int)(sizeof(int) * count)) ;
    if(!ptsOut || !width || !Marked || (count < 3) || (y <= 0))
    {
	 ;
	 ;
	 ;
	return;
    }
    for(j = 0; j < count; j++)
	Marked[j] = 0;
    nextleft = nextright = imin;
    Marked[imin] = -1;
    y = (int) ({ double __value, __arg = (ptsIn[nextleft].y + yFtrans); int __fpcr; asm ("fmovel fpcr, %0": "=dm" (__fpcr)); asm volatile ("fmovel %1, fpcr": "=m" (*(char *)0): "dm" ((__fpcr & 0xffffffcf) | 0x30)); asm ("fintx %1, %0": "=f" (__value): "f"
 (__arg)); asm volatile ("fmovel %1, fpcr": "=m" (*(char *)0): "dm" (__fpcr)); __value; }) ;
    do
    {
        if ((y > (ptsIn[nextleft].y + yFtrans) ||
 	     ((((y) - ( ptsIn[nextleft].y + yFtrans)) > 0.0 ? ((y) - ( ptsIn[nextleft].y + yFtrans)) : -((y) - ( ptsIn[nextleft].y + yFtrans)))	 <= 0.000001 ) ) &&
	     Marked[nextleft] != 1)
	{
	    Marked[nextleft]++;
            left = nextleft++;
            if (nextleft >= count)
                nextleft = 0;
	    dy = ptsIn[nextleft].y - ptsIn[left].y;
	    if (dy != 0.0)
	    { 
		ml = (ptsIn[nextleft].x - ptsIn[left].x) / dy;
		dy = y - (ptsIn[left].y + yFtrans);
		xl = (ptsIn[left].x + xFtrans) + ml * (((dy) > ( 0)) ? (dy) : ( 0)) ; 
	    }
        }
        if ((y > ptsIn[nextright].y + yFtrans) ||
 	     ((((y) - ( ptsIn[nextright].y + yFtrans)) > 0.0 ? ((y) - ( ptsIn[nextright].y + yFtrans)) : -((y) - ( ptsIn[nextright].y + yFtrans)))	 <= 0.000001 ) 
	     && Marked[nextright] != 1)
	{
	    Marked[nextright]++;
            right = nextright--;
            if (nextright < 0)
                nextright = count - 1;
	    dy = ptsIn[nextright].y - ptsIn[right].y;
	    if (dy != 0.0) 
	    { 
		mr = (ptsIn[nextright].x - ptsIn[right].x) / dy;
		dy = y - (ptsIn[right].y + yFtrans); 
		xr = (ptsIn[right].x + xFtrans) + mr * (((dy) > ( 0)) ? (dy) : ( 0)) ;
	    }
        }
        i = ((((ptsIn[nextleft].y) < ( ptsIn[nextright].y)) ? (ptsIn[nextleft].y) : ( ptsIn[nextright].y))  + yFtrans) - y;
	if (i < 0.000001 )
	{
	    if(Marked[nextleft] && Marked[nextright])
	    {
	        break;
	    }
	    continue;
	}
	else
	{
		j = (int) i;
		if(!j)
		    j++;
	}
        while (j > 0) 
        {
            ptsOut->y = (y) + yTrans;
            if (xl < xr) 
            {
                *(width++) = ({ double __value, __arg = (xr); int __fpcr; asm ("fmovel fpcr, %0": "=dm" (__fpcr)); asm volatile ("fmovel %1, fpcr": "=m" (*(char *)0): "dm" ((__fpcr & 0xffffffcf) | 0x30)); asm ("fintx %1, %0": "=f" (__value): "f" (__arg));
 asm volatile ("fmovel %1, fpcr": "=m" (*(char *)0): "dm" (__fpcr)); __value; })  - ({ double __value, __arg = (xl); int __fpcr; asm ("fmovel fpcr, %0": "=dm" (__fpcr)); asm volatile ("fmovel %1, fpcr": "=m" (*(char *)0): "dm" ((__fpcr & 0xffffffcf) 



)); asm ("fintx %1, %0": "=f" (__value): "f" (__arg)); asm volatile ("fmovel %1, fpcr": "=m" (*(char *)0): "dm" (__fpcr)); __value; }) ;
                (ptsOut++)->x = ({ double __value, __arg = (xl); int __fpcr; asm ("fmovel fpcr, %0": "=dm" (__fpcr)); asm volatile ("fmovel %1, fpcr": "=m" (*(char *)0): "dm" ((__fpcr & 0xffffffcf) | 0x30)); asm ("fintx %1, %0": "=f" (__value): "f" (__arg
)); asm volatile ("fmovel %1, fpcr": "=m" (*(char *)0): "dm" (__fpcr)); __value; })  + xTrans;
            }
            else 
            {
                *(width++) = ({ double __value, __arg = (xl); int __fpcr; asm ("fmovel fpcr, %0": "=dm" (__fpcr)); asm volatile ("fmovel %1, fpcr": "=m" (*(char *)0): "dm" ((__fpcr & 0xffffffcf) | 0x30)); asm ("fintx %1, %0": "=f" (__value): "f" (__arg));
 asm volatile ("fmovel %1, fpcr": "=m" (*(char *)0): "dm" (__fpcr)); __value; })  - ({ double __value, __arg = (xr); int __fpcr; asm ("fmovel fpcr, %0": "=dm" (__fpcr)); asm volatile ("fmovel %1, fpcr": "=m" (*(char *)0): "dm" ((__fpcr & 0xffffffcf) 



)); asm ("fintx %1, %0": "=f" (__value): "f" (__arg)); asm volatile ("fmovel %1, fpcr": "=m" (*(char *)0): "dm" (__fpcr)); __value; }) ;
                (ptsOut++)->x = ({ double __value, __arg = (xr); int __fpcr; asm ("fmovel fpcr, %0": "=dm" (__fpcr)); asm volatile ("fmovel %1, fpcr": "=m" (*(char *)0): "dm" ((__fpcr & 0xffffffcf) | 0x30)); asm ("fintx %1, %0": "=f" (__value): "f" (__arg
)); asm volatile ("fmovel %1, fpcr": "=m" (*(char *)0): "dm" (__fpcr)); __value; })  + xTrans;
            }
            y++;
	    xl += ml;
	    xr += mr;
	    j--;
        }
    }  while (y <= ymax);
    (*pgc->FillSpans)(dst, pgc, 
		      ptsOut-FirstPoint, FirstPoint, FirstWidth, 1);
}



3.) Command Used : gcc -O -finline-functions -fstrength-reduce
----------------

4.) Files used :
--------------
		tm.h          -> tm-sparc.h
		md            -> sparc.md
      config.h      -> xm-sunos4.h
      aux-output.c  -> output-sparc.c
      
5.) Machine(s) used :
-------------------
   Sun 4 running Sun4.0

6.) Compiler diagnostics :
------------------------

gcc version 1.31
 /usr/public/lib/gcc/gcc-cpp -v -I/cd/ua/schmidt/include/ -undef
-D__GNU__ -D__GNUC__ -Dsparc -Dsun -Dunix -D__OPTIMIZE__
quinn-bug.1.30.c /tmp/cca18663.cpp GNU CPP version 1.31
 /usr/public/lib/gcc/gcc-cc1 /tmp/cca18663.cpp -quiet -dumpbase
quinn-bug.1.30.c -finline-functions -finline-functions
-fstrength-reduce -O -version -o /tmp/cca18663.s /usr/public/gcc:
Program cc1 got fatal signal 11.