[gnu.gcc.bug] gcc gets fatal signal 6

jeff@lorrie.atmos.washington.edu (Jeff Bowden) (10/18/88)

When compiling a small program gcc 1.30 (with preprocessor fix) on a Sun3
running SunOS 3.5, gcc bombs.  It does work with other small to medium code
samples, though.


Here's the sample run.
----------------------------------------------------------------< CUT HERE
% make sgp.o
gcc -g -W -I. -v -c sgp.c
gcc version 1.30
 /usr/local/lib/gcc-cpp -v -I. -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__HAVE_68881__ -Dmc68020 sgp.c /tmp/cca00521.cpp
GNU CPP version 1.30
 /usr/local/lib/gcc-cc1 /tmp/cca00521.cpp -quiet -dumpbase sgp.c -g -W -version -o /tmp/cca00521.s
GNU C version 1.30 (68k, MIT syntax) compiled by GNU C version 1.30.
gcc: Program cc1 got fatal signal 6.
*** Error code 1

Stop.
----------------------------------------------------------------< CUT HERE

And here's the source.
----------------------------------------------------------------< CUT HERE
gcc version 1.30
 /usr/local/lib/gcc-cpp -v -I. -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__HAVE_68881__ -Dmc68020 sgp.c
# 1 "sgp.c"
 









# 1 "./framebuffer.h"
 












 



 



 
typedef int COLOR;

 
extern int fb_open(), fb_close(), fb_writePixel(), fb_flush();
extern char *fb_error_message;
# 11 "sgp.c"

# 1 "bresenham.h"
 









void bresenham(void point_func(int,int),
	       double x0, double y0,
	       double x1, double y1);
# 12 "sgp.c"

# 1 "xform.h"
 









typedef struct { double d[3]; } point;
typedef struct { double dd[3][3]; } xform;




 







point dot_p_x(point, xform);
xform dot_x_x(xform, xform);

void rotate(xform *, double radians);
void translate(xform *, double dx, double dy);
void scale(xform *, double sx, double sy);
# 13 "sgp.c"

# 1 "sgp.h"
 


















 

void sgp_init(void);

void move_abs(double x, double y);
void line_abs(double x, double y);

void move_rel(double dx, double dy);
void line_rel(double dx, double dy);

void set_color(COLOR color);
void set_window(double left, double bottom, double right, double top);

 







# 14 "sgp.c"


 



typedef struct {
  xform world2ndc;
  xform ndc2device;
  point cp;		 
  COLOR clr;
} gstate;

static xform hack = { {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}} } ;

static void die(char *s);
static int clip_ndc(point *p1, point *p2);
static void line(point from, point to);

static gstate gs = {{ {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}} } , { {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}} } , { {0.0, 0.0, 1.0} } ,           1 };


 


void sgp_init(void)
{
  int minX, minY, maxX, maxY;

  if (fb_open(&minX, &minY, &maxX, &maxY) !=      0 )
    die(fb_error_message);

   



   
  scale(&gs.ndc2device, 1.0, -1.0);

   
  scale(&gs.ndc2device, (maxY - minY), (maxY - minY));

   
  translate(&gs.ndc2device, minX, maxY);

   
  translate(&gs.ndc2device, ((maxX - minX) - (maxY - minY))/2, 0.0);

  
}


void set_color(COLOR clr)
{
  gs.clr = clr;
}


void set_window(double left, double bottom, double right, double top)
{

  gs.world2ndc = hack;		        

  scale(&gs.world2ndc, right - left, top - bottom);
  translate(&gs.world2ndc, left, bottom);
}


void move_abs(double x, double y)
{
  ((gs.cp).d[0])  = x;
  ((gs.cp).d[1])  = y;
}


void line_abs(double x, double y)
{
  point pt = { {0.0, 0.0, 1.0} } ;

  ((pt).d[0])  = x;
  ((pt).d[1])  = y;
  line(gs.cp, pt);
  gs.cp = pt;
}


void move_rel(double dx, double dy)
{
  ((gs.cp).d[0])  += dx;
  ((gs.cp).d[1])  += dy;
}


void line_rel(double dx, double dy)
{
  point pt = { {0.0, 0.0, 1.0} } ;

  ((pt).d[0])  = ((gs.cp).d[0])  + dx;
  ((pt).d[1])  = ((gs.cp).d[1])  + dy;

  line(gs.cp,pt);
  gs.cp = pt;
}


 


static void die(char *s)
{
  printf("sgp: %s\n", s);
  exit(-1);
}

static void write_pixel(int x, int y)
{
  fb_writePixel(x, y, gs.clr);
}

  
static void line(point from, point to)
{

  from = dot_p_x(from, gs.world2ndc);
  to = dot_p_x(to, gs.world2ndc);

  if (clip_ndc(&from, &to))
    {
      from = dot_p_x(from, gs.ndc2device);
      to = dot_p_x(to, gs.ndc2device);
      bresenham(write_pixel, ((from).d[0]) , ((from).d[1]) , ((to).d[0]) , ((to).d[1]) );
    }
}


static int clip_ndc(point *from, point *to)
 



{
  return 1;
}
GNU CPP version 1.30
----------------------------------------------------------------< CUT HERE