schmidt%blanche.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt") (11/24/88)
Bug Report for GCC: ------------------- Problem : The following program causes a fatal signal in gcc 1.31 running on the sparc. 1.) Version : gcc 1.31 ----------- 2.) Input Program : ----------------- /* gcc -g -W -I. -v -c 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; } 3.) Command Used : gcc -g -W -I. -v -c ---------------- 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. -I/cd/ua/schmidt/include/ -undef -D__GNU__ -D__GNUC__ -Dsparc -Dsun -Dunix cpp-bug.1.30.c /tmp/cca17470.cpp GNU CPP version 1.31 /usr/public/lib/gcc/gcc-cc1 /tmp/cca17470.cpp -quiet -dumpbase cpp-bug.1.30.c -finline-functions -g -W -version -o /tmp/cca17470.s GNU C version 1.31 (sparc) compiled by GNU C version 1.31. /usr/public/gcc: Program cc1 got fatal signal 6.