[gnu.gcc.bug] Gcc 1.31 gets fatal signal on sparc

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

Bug Report for GCC:
-------------------
Problem : The following input file causes a fatal signal on the sun 4.
          Note that this does *not* happen when -O is used!

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

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

/* don't use -O */
typedef struct {
 int             w;
 unsigned int    f;
} real;

main()
{
 real a = {-10,10};

}


3.) Command Used : gcc 
----------------

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 fatal_sparc-bug.1.28.c /tmp/cca16562.cpp
GNU CPP version 1.31
 /usr/public/lib/gcc/gcc-cc1 /tmp/cca16562.cpp -quiet -dumpbase fatal_sparc-bug.1.28.c -finline-functions -version -o /tmp/cca16562.s
GNU C version 1.31 (sparc) compiled by GNU C version 1.31.
/usr/public/gcc: Program cc1 got fatal signal 6.

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

Bug Report for GCC:
-------------------
Problem : the following program crashes gcc 1.31 on the sun4.
         

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

2.) Input Program :
-----------------
float  gf;

main ()
{
	gf = 0;

	reg_vlong ((long long)0);
	reg_vlong ((long long)1);
}

3.) Command Used : gcc 
----------------

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 test2-bug.1.28.c /tmp/cca16888.cpp
GNU CPP version 1.31
 /usr/public/lib/gcc/gcc-cc1 /tmp/cca16888.cpp -quiet -dumpbase test2-bug.1.28.c -finline-functions -version -o /tmp/cca16888.s
GNU C version 1.31 (sparc) compiled by GNU C version 1.31.
/usr/public/gcc: Program cc1 got fatal signal 6.

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

Bug Report for GCC:
-------------------
Problem : The following program kills gcc 1.31 running on the sun 4.
          The problem doesn't appear if -O is used.

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

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

# 1 "device.c"
# 1 "main.h"
# 1 "/usr/include/stdio.h"
extern	struct	_iobuf {
	int	_cnt;
	unsigned char *_ptr;
	unsigned char *_base;
	int	_bufsiz;
	short	_flag;
	char	_file;		 
} _iob[];
extern struct _iobuf 	*fopen();
extern struct _iobuf 	*fdopen();
extern struct _iobuf 	*freopen();
extern struct _iobuf 	*popen();
extern struct _iobuf 	*tmpfile();
extern long	ftell();
extern char	*fgets();
extern char	*gets();
extern char	*ctermid();
extern char	*cuserid();
extern char	*tempnam();
extern char	*tmpnam();
# 5 "main.h"
# 1 "/usr/include/math.h"
extern int errno, signgam;
extern double fmod(), gamma();
extern int matherr();
extern double asinh(), acosh(), atanh();
extern double erf(), erfc();
extern double exp(), expm1(), log(), log10(), log1p(), pow();
extern double fabs(), floor(), ceil(), rint();
extern double lgamma();
extern double hypot(), cabs();
extern double copysign(), drem(), logb(), scalb();
extern int finite();
extern double j0(), j1(), jn(), y0(), y1(), yn();
extern double sin(), cos(), tan(), asin(), acos(), atan(), atan2();
extern double sinh(), cosh(), tanh();
extern double cbrt(), sqrt();
extern double modf(), ldexp(), frexp(), atof();
# 55 "/usr/include/math.h"
struct exception {
	int type;
	char *name;
	double arg1;
	double arg2;
	double retval;
};
# 6 "main.h"
# 1 "/usr/local/lib/gcc-include/assert.h"
void _eprintf ();		 
# 7 "main.h"
# 1 "/usr/include/setjmp.h"
typedef int jmp_buf[15];	 
# 8 "main.h"
# 1 "/usr/include/strings.h"
char	*strcat();
char	*strncat();
int	strcmp();
int	strncmp();
char	*strcpy();
char	*strncpy();
int	strlen();
char	*index();
char	*rindex();
# 9 "main.h"
typedef struct dict_struct *Type;
typedef struct object
 {
 	int flags;
	Type type;
	int Length;
	union
	 {
		int Integer, Boolean, Font;
	 	float Real;
	 	Type Dictionary;
	 	unsigned char *String;
	 	struct name_struct *Name;
	 	struct op_struct *Operator;
	 	struct file_struct *File;
	 	struct object *Array;
	 } u;
	
 } Object;
enum file_type { StringFile, StreamFile };
struct file_struct
 {
 	enum file_type file_type;
 	int available;
 	union
 	 {
 	 	unsigned char	*c_ptr;
 	 	struct _iobuf 	*f_ptr;
 	 } f;
 };
struct dict_entry
 {
 	Object entry_key, entry_value;
 };
struct dict_struct
 {
 	int dict_flags, dict_size, dict_fill;
 	struct dict_entry *dict_body;
 };
typedef struct stack
 {
 	int stack_fill, stack_size;
 	Object overflow, underflow, *stack_body;
 } *Stack, StackOb;
Object SameFlags (), MakeObject (), Cvx (), Cvlit (), ReadOnly (), WriteOnly (), ExecOnly ();
int OpCheck (), min (), rCheck (), wCheck (), xCheck ();
Object MakeArray (), ParseArray (), getArray (), getIArray (), *BodyArray ();
Object MakeBoolean ();
Object MakeDict (), DictLoad (), Lookup (), DictFrom (), Load ();
Type MakeType (), TypeOf (), BodyDict ();
extern int EqTrue (), Equal ();
Object FileFrom (), FileString ();
int Getch ();
struct file_struct *BodyFile ();
Object MakeInteger (), IntReal ();
Object ParseNumber ();
float Deg (), Rad ();
Object ParseId (), NameFrom (), MakeName (), Cvn (), StringName ();
unsigned char *BodyName ();
Object MakeOp (), NameOperator ();
Object Parse ();
int PolyFirst (), PolySecond (), PolyThird (), PolyPair ();
Object MakeReal (), RealInteger ();
float BodyReal (), BodyFloat ();
char *Malloc ();
Object Pop (), Top (), Where (), DictLookup ();
int Push ();
extern Object MakeString (), StringFrom (), getIString (), ParseString (), ParseHexString ();
unsigned char *BodyString ();
int lengthString ();
extern Object PDictFull;
extern Object PDictOverflow,		PInvFont,		PSyntaxError;
extern Object PDictUnderflow,		PInvRestore,		PTypeCheck;
extern Object PExecOverflow,		PIOError,		PUndefined;
extern Object PExecUnderflow,		PLimitCheck,		PUnFilename;
extern Object PInterrupt,		PNoCurrentPoint,	PUnResult;
extern Object PInvAccess,		PRangeCheck,		PUnMatched;
extern Object PInvExit,			POpOverflow,		PUnregistered;
extern Object PInvFileAccess,		POpUnderflow,		PVMError;
extern Type Boolean, Mark, String, Real, Poly, Operator;
extern Type Name, File, Dictionary, Condition, Null, Integer;
extern Type Array, Mark, Condition, Null, Float, FontID;
extern Object SysDict, Absent, Nil;
extern Object True, False, Marker, Self;
extern Object OpInterp, Lbracket, Rbracket;
extern Object StatementEdit, Fstdin, Fstdout, Fstderr;
extern Stack OpStack, ExecStack, DictStack;
extern jmp_buf env;
extern int interactive, verbose;
extern char default_library[], *library;
extern unsigned char *Bcopy ();
extern struct _iobuf  *vfp, *Fopen ();
extern void Fclose ();
extern int getchbuf;
Object DictFind();
# 12 "device.c"
# 1 "graphics.h"
# 1 "device.h"
# 1 "hard.h"
# 1 "mat.h"
typedef struct matrix { float A, B, C, D, tx, ty; } Matrix;
typedef struct vector { float vx, vy, vt; } Vector;
extern Matrix NewMatrix (), MatMult (), MatInvert (), Translate (), Rotate (), Scale ();
extern Vector NewVector (), DiffVector ();
extern Vector Transform (), ITransform (), DTransform (), IDTransform ();
# 5 "hard.h"
# 1 "rop.h"
# 6 "hard.h"
# 1 "colour.h"
typedef struct { float hue, saturation, brightness; } Colour;
extern Colour Black, White;
extern Colour NewColour (), NewHSBColour (), NewRGBColour (), NewGray ();
extern void ColourHSB (), ColourRGB ();
extern float Gray (), Brightness ();
# 7 "hard.h"
# 1 "path.h"
typedef struct hard_point { float hx, hy; } HardPoint;
enum pelem_type { EHeader, EMove, ELine, EArc, ECurve, EClose };
struct path_element
 {
 	enum pelem_type ptype;
 	union {
  		HardPoint point;
		struct arc { int dir; HardPoint centre; float radius, from, to; } arc;
 		struct bezier { HardPoint x0, x1, x2; } curve;
 	} pe;
 	struct path_element *next, *last;
 };
typedef struct path_element *Path;
extern HardPoint NewHardPoint (), ExtToInt (), MoveHardPoint ();
extern Path NewPath (), PathCopy (), NewMove ();
extern int PNewPath (), PInitMatrix ();
extern Path NewClipPath (), PathRemove (), ReversePath (), FlattenPath ();
extern float Normalise (), PointX (), PointY ();
# 8 "hard.h"
typedef struct device_point { int dx, dy; } DevicePoint;
extern struct hardware *HardwareFromString (), *NewBitmapHardware (), *NewWindowHardware (), *InitHardware ();
extern DevicePoint HardwareExtent ();
extern char *StringFromHardware ();
extern void BitBlt (), BitBltBlob (), BitBltLine (), DestroyHardware ();
extern void HardUpdate (), UpdateControl ();
extern Matrix DeviceMatrix ();
extern void RasterTile (), BitBltTrapezoid ();
extern int IsWindowHardware (), TransferSize ();
extern void SetTransfer ();
extern void Paint (), PaintLine (), PaintTrapezoid ();
extern int ScreenSize ();
extern void BuildScreen (), SetScreen ();
extern DevicePoint NewDevicePoint ();
# 5 "device.h"
struct device
 {
 	Matrix default_matrix;
 	Path default_clip;
 	int link_count;
 	struct hardware *dev;
 };
extern struct device *NewDevice (), *NewCacheDevice (), *LinkDevice (), *DeviceFrom (), *UniqueDevice ();
extern struct device *NewBitmapDevice ();
# 5 "graphics.h"
# 1 "point.h"
typedef struct point { float x, y; } Point;
extern Matrix PointTranslate ();
extern Point NewPoint (), IntToExt (), MovePoint ();
extern int MoveTo (), LineTo ();
extern Object AssignMatrix ();
# 6 "graphics.h"
# 1 "font.h"
extern Object Fid, FD, FontMatrix, FontType, Encoding, FontBBox, FontName;
extern Object UserShow, CharStrings, Metrics;
# 7 "graphics.h"
struct show_context
 {
 	char InShow;
 	char space;
	Point Width;
	HardPoint shim, space_shim;
 	Object CharName;
 	struct cache *ccache;
 	Matrix mat;
 };
struct state
 {
 	Matrix CTM;
 	Colour colour;
 	HardPoint cp; int cp_defined;
 	Path path;
 	Path clip;
 	Object font;
 	float line_width;
 	int line_cap;
 	int line_join;
 	struct
 	 {
 	 	float frequency, rotation, *thresh;
 	 	int count;
 	 	Object spot_function;
 	  } screen;
 	struct {
 		Object transfn;
 		float *tran;
 		int tcount;
 	} transfer;
 	int flatness;
 	float miter_limit;
 	float dash_offset, dash_array [11 ];
 	int dash_length;
	struct device *device;
	struct show_context *show;
	struct device *clipdevice;
 };
extern struct state *gstate;
extern int stroke_method, fill_method;
# 13 "device.c"
static int NullDevice ();
static int FrameDevice ();
static int GrabBits ();
Colour Black = { 0.0, 0.0, 0.0 }, White = { 0.0, 0.0, 1.0 };
struct device *NewWindowDevice (), *NewBitmapDevice (), *NewCacheDevice ();
InitDevices ()
 {
 	struct hardware *h;
 	DevicePoint extent;
 	
	InstallOp ("framedevice",	FrameDevice, 		4, 0, 0, 0, Array, Integer, Integer, Array);
	InstallOp ("nulldevice",	NullDevice,		0, 0, 0, 0);
	InstallOp ("grabbits",		GrabBits,		4, 0, 0, 0, Float, Float, Float, Float);
	
	extent = HardwareExtent (h = InitHardware ());
 	gstate->device = 0 ; gstate->clipdevice = 0 ;
	SetDevice (LinkDevice (DeviceFrom (h, DeviceMatrix (extent.dx, extent.dy))));
 }
static int GrabBits (x, y, w, h) Object x, y, w, h;
 {
 	HardPoint origin, corner, extent;
 	int width, height, size;
 	char *s;
 	struct hardware *dev;
 	
 	origin = ExtToInt (NewPoint (BodyReal (x), BodyReal (y)));
 	corner = ExtToInt (NewPoint (BodyReal (x) + BodyReal (w), BodyReal (y) + BodyReal (h)));
 	width = corner.hx - origin.hx;
 	height = corner.hy - origin.hy;
 	
 	fprintf ((&_iob[2]) , "width = %d, height = %d\n", width, height);
 	
 	extent = NewHardPoint ((float) width, (float) height);
 	
 	dev = NewBitmapHardware (width, height);
 	
 	BitBlt (gstate->device->dev, dev,
 		NewDevicePoint ((int) origin.hx, (int) origin.hy),
 		NewDevicePoint (0, 0),
 		NewDevicePoint ((int) extent.hx, (int) extent.hy),
 		3	);
 	s = StringFromHardware (dev);
 	DestroyHardware (dev);
 	size = (width + 7) / 8 * height;
 	
 	(((OpStack)->stack_fill != (OpStack)->stack_size) ?	((OpStack)->stack_body[(OpStack)->stack_fill] = ( MakeString (s, size)), (OpStack)->stack_fill++, 	1 ) : 	0 ) ;
 	Free (s);
 	(((OpStack)->stack_fill != (OpStack)->stack_size) ?	((OpStack)->stack_body[(OpStack)->stack_fill] = ( MakeInteger (width)), (OpStack)->stack_fill++, 	1 ) : 	0 ) ;
 	(((OpStack)->stack_fill != (OpStack)->stack_size) ?	((OpStack)->stack_body[(OpStack)->stack_fill] = ( MakeInteger (height)), (OpStack)->stack_fill++, 	1 ) : 	0 ) ;
 	
 	return 	1 ;
 }
static int NullDevice ()
 {
 	SetDevice (
 		NewDevice (
 			NewClipPath (0.0, 0.0, 0.0, 0.0),
 			NewMatrix (1.0, 0.0, 0.0, 1.0, 0.0, 0.0),
 			(struct hardware *) 0 ));
 	return 	1 ;
 }
static int FrameDevice (mat, width, height, proc) Object mat, width, height, proc;
 {
 	Matrix m;
 	
 	if (lengthArray (mat) != 6 || !ExtractMatrix (&m, mat))
 		return Error (PTypeCheck);
 	if (BodyInteger (width) < 0 || BodyInteger (height) < 0)
 		return Error (PRangeCheck);
 	SetDevice (NewWindowDevice (BodyInteger (width) * 8, BodyInteger (height), m));
 	ErasePage ();
 	
	return 	1 ;
 }
struct device *DeviceFrom (h, m) struct hardware *h; Matrix m;
 {
 	DevicePoint extent;
 	
 	extent = HardwareExtent (h);
 	return NewDevice (
 			NewClipPath (0.0, (float) extent.dx, (float) extent.dy, 0.0),
 			m,
 			h);
 }
struct device *NewWindowDevice (width, height, m) int width, height; Matrix m;
 {
 	return DeviceFrom (NewWindowHardware (width, height), m);
 }
struct device *NewBitmapDevice (width, height, m) int width, height; Matrix m;
 {
 	return DeviceFrom (NewBitmapHardware (width, height), m);
 }
struct device *NewCacheDevice (m, width, height, swidth, sheight) Matrix m; int width, height, swidth, sheight;
 {
 	return NewDevice (
 			NewClipPath (0.0, (float) width, (float) height, 0.0),
 			NewMatrix (m.A, m.B, m.C, m.D, (float) swidth, (float) height - sheight),
 			NewBitmapHardware (width, height));
 }
Path NewClipPath (left, right, top, bottom) float left, right, top, bottom;
 {
 	Path p = NewPath ();
 	HardPoint cp;
 	int cp_def = gstate->cp_defined;
 	
 	cp = gstate->cp;
 	(void)  MoveTo (p, NewHardPoint (left, 	bottom));
 	(void)  LineTo (p, NewHardPoint (right, bottom));
 	(void)  LineTo (p, NewHardPoint (right, top));
 	(void)  LineTo (p, NewHardPoint (left,  top));
 	ClosePath (p);
 	
 	gstate->cp = cp; gstate->cp_defined = cp_def;
 	
 	return p;
 }
struct device *NewDevice (clip, m, dev) Path clip; Matrix m; struct hardware *dev;
 {
 	struct device *res = (struct device *) Malloc (sizeof (struct device));
 	
 	res->link_count = 0;
 	res->default_clip = clip;
 	res->default_matrix = m;
 	res->dev = dev;
 	
 	return res;
 }
SetDevice (d) struct device *d;
 {
 	UnlinkDevice (gstate->device);
 	gstate->device = LinkDevice (d);
 	gstate->CTM = d->default_matrix;
 	InitClip ();
 }
int IsCache (d) struct device *d;
 {
	return !IsWindowHardware (d->dev);
 }
struct device *LinkDevice (d) struct device *d;
 {
 	if (d)
 		++d->link_count;
 	
	return d;
 }
UnlinkDevice (d) struct device *d;
 {
 	if (d == 0 )
 		return;
 	if (--d->link_count != 0)
		return;
	if (d->dev != 0 )
 		DestroyHardware (d->dev);	
 	Free ((char *) d);
 }
struct device *UniqueDevice (d) struct device *d;
 {
 	struct device *res;
 	DevicePoint ex;
 	
 	if (d && d->link_count == 1)
 		return d;
 	ex = HardwareExtent (gstate->device->dev);
 	res = LinkDevice (NewBitmapDevice (ex.dx, ex.dy, gstate->CTM));
 	 
BitBlt (0 , res->dev, NewDevicePoint (0, 0), NewDevicePoint (0, 0), ex, 0	);
 	
 	return res;
 }
DevicePoint NewDevicePoint (x, y) int x, y;
 {
 	DevicePoint res;
 	
 	res.dx = x; res.dy = y;
 	
 	return res;
 }
DevicePoint HardToDevice (p) HardPoint p;
 {
 	return NewDevicePoint ((int) p.hx, (int) p.hy);
 }
DevicePaintLine (d, fromPoint, toPoint, colour)
	struct device *d;
	HardPoint fromPoint, toPoint;
	Colour colour;
 {
 	PaintLine (d->dev, HardToDevice (fromPoint), HardToDevice (toPoint), colour);
 }

3.) Command Used : gcc 
----------------

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 trap-bug.1.28.c /tmp/cca17193.cpp
GNU CPP version 1.31
 /usr/public/lib/gcc/gcc-cc1 /tmp/cca17193.cpp -quiet -dumpbase trap-bug.1.28.c -finline-functions -version -o /tmp/cca17193.s
GNU C version 1.31 (sparc) compiled by GNU C version 1.31.
/usr/public/gcc: Program cc1 got fatal signal 6.

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

Bug Report for GCC:
-------------------
Problem :  The following program gets a fatal signal on the sparc when
	        compiled with the -finline-functions -fstrength-reduce -O
           options enabled

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

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


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);
}

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

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__ q-bug-1.30.c /tmp/cca18644.cpp
GNU CPP version 1.31
 /usr/public/lib/gcc/gcc-cc1 /tmp/cca18644.cpp -quiet -dumpbase q-bug-1.30.c -finline-functions -finline-functions -fstrength-reduce -O -version -o /tmp/cca18644.s
/usr/public/gcc: Program cc1 got fatal signal 11.