[gnu.gcc.bug] bug in gcc 1.30 for Sun FPA

trq@moose.cita.utoronto.ca (Tom Quinn) (10/18/88)

The following code will cause gcc to get a fatal error if compiled
with "-O -mfpa" options.  This gcc version 1.30 on a Sun3/160 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 -mfpa  -sun3 -c  nsat2.c
gcc version 1.30
 /usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ -D__HAVE_FPA__ -D__HAVE_68881__ -Dmc68020 nsat2.c /tmp/cca06058.cpp
GNU CPP version 1.30
 /usr/local/lib/gcc-cc1 /tmp/cca06058.cpp -quiet -dumpbase nsat2.c -mfpa -g -O -version -o /tmp/cca06058.s
GNU C version 1.30 (68k, MIT syntax) compiled by GNU C version 1.30.
gcc: Program cc1 got fatal signal 6.

The code:
------------------------------------------------------------------------
extern double drem();
struct sat {
    double a;			 
    double e;			 
    double pomega;
    double mu;			 
    double omega;		 
    double phi;
    double p0;			 
    double yr, yi;		 
    int n;			 
    int index;			 
    int current;		 
};
static double dt;
struct sat *nextpl(pl, nplanet, test)
struct sat *pl;
int nplanet;
struct sat test;
{
    struct sat *sptr, *encptr;
    double dtmin, dttry;
    double dphi;
    dtmin = 1.0 / 1.0e-12 ;
    encptr = 0 ;
    for(sptr = pl; sptr < pl + nplanet; sptr++) {
	if(sptr->current == 0) {  
	    if(test.a > sptr->a) {
		dphi = test.phi - sptr->phi;
	    } else {
		dphi = sptr->phi - test.phi;
	    }
	    dphi = drem(dphi, (2.0*3.14159265358979323846 ) );
	    if(dphi < 0.0) dphi = (2.0*3.14159265358979323846 )  + dphi;
	    if((dttry = dphi/({ double __value, __arg = (sptr->omega - test.omega); asm ("fpabsd %1, %0": "=xy" (__value): "xym" (__arg)); __value; }) ) < dtmin) {
		dtmin = dttry;
		encptr = sptr;
	    }
	}
    }
    for(sptr = pl; sptr < pl + nplanet; sptr++) {
	dphi = (2.0*3.14159265358979323846 ) ;
	if((dttry = dphi/({ double __value, __arg = (sptr->omega - test.omega); asm ("fpabsd %1, %0": "=xy" (__value): "xym" (__arg)); __value; }) ) < dtmin) {
	    dtmin = dttry;
	    encptr = sptr;
	}
    }
    dt = dtmin;
    return (encptr);
}

vern@sequoia.ee.lbl.gov (Vern Paxson) (10/22/88)

In article <8810181407.AA06061@moose.cita.utoronto.ca> trq@moose.cita.utoronto.ca (Tom Quinn) writes:
>The following code will cause gcc to get a fatal error if compiled
>with "-O -mfpa" options.  This gcc version 1.30 on a Sun3/160 running
>SunOS 4.0.
...
>gcc -g -v -O -mfpa  -sun3 -c  nsat2.c
...
>gcc: Program cc1 got fatal signal 6.
>
>The code:
...

I've found the bug can be reduced to the following input:

	a()
	    {
	    double b;
	    b == 0.0;
	    }

This is gcc version 1.29 on a Sun 3/60 running SunOS 3.5.

		Vern
	Vern Paxson				vern@lbl-csam.arpa
	Real Time Systems			ucbvax!lbl-csam.arpa!vern
	Lawrence Berkeley Laboratory		(415) 486-6411