trq@moose.cita.toronto.edu (Tom Quinn) (09/21/88)
The following program causes gcc to get a fatal signal when compiled with "-g -O". This is for a Sun 3/50 running SunOS 3.5 with a fix to tm-sun3.h to put a space between __HAVE_FPU__ and -Dmc68020 in the parameter list of cpp. Tom Quinn Canadian Institute for Theoretical Astrophysics trq@moose.cita.toronto.edu SOON TO BE 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 -c ScrollByLine.c gcc version 1.28 /usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ -D__HAVE_FPU__ -Dmc68020 ScrollByLine.c /tmp/cca09164.cpp GNU CPP version 1.28 /usr/local/lib/gcc-cc1 /tmp/cca09164.cpp -quiet -dumpbase ScrollByLine.c -g -O -version -o /tmp/cca09164.s GNU C version 1.28 (68k, MIT syntax) compiled by GNU C version 1.28. gcc: Program cc1 got fatal signal 6. The code: ------------------------------------------------------------------------ typedef char * caddr_t; typedef unsigned long XID; typedef XID Window; typedef struct _XGC { int rects; } *GC; typedef struct { struct _XDisplay *display; } Screen; typedef struct _XDisplay { int fd; } Display; GC XCreateGC(); typedef struct _WidgetRec *Widget; typedef Widget *WidgetList; typedef char Boolean; typedef unsigned int Dimension; extern void XtCallCallbacks (); typedef struct _CorePart { Screen *screen; Window window; Dimension width, height; } CorePart; typedef struct _WidgetRec { CorePart core; } WidgetRec; typedef struct _CompositePart { WidgetList children; } CompositePart; typedef struct _CompositeRec { CorePart core; CompositePart composite; } CompositeRec; typedef struct _ScrollByLineRec *ScrollByLineWidget; typedef struct _ScrollByLineStruct { int location; int start_line; int num_lines; } ScrollByLineStruct; typedef struct _ScrollByLinePart { int inner_width, inner_height; int lines; int font_height; int line_pointer; } ScrollByLinePart; typedef struct _ScrollByLineRec { CorePart core; CompositePart composite; ScrollByLinePart scroll_by_line; } ScrollByLineRec; static Boolean ScrollVerticalText(w,new_line,force_redisp) Widget w; int new_line; Boolean force_redisp; { ScrollByLineWidget sblw = (ScrollByLineWidget) w; int max_lines, num_lines, y_pos, num_lines_disp, start_line, y_location, lines_to_move; GC gc; Widget child,vbar; ScrollByLineStruct * sblw_struct; Boolean move_thumb = 0 ; child = sblw->composite.children[2]; vbar = sblw->composite.children[0]; num_lines = child->core.height / sblw->scroll_by_line.font_height; gc = XCreateGC((( (Widget) sblw)->core.screen->display) ,((child)->core.window) ,0 ,0); XSetGraphicsExposures((( (Widget) sblw)->core.screen->display) ,gc, 1 ); if ( new_line < 0) { move_thumb = 1 ; new_line = 0; } else { max_lines = sblw->scroll_by_line.lines - child->core.height / sblw->scroll_by_line.font_height; if ( new_line > max_lines ) { new_line = max_lines; move_thumb = 1 ; } } if ( new_line == sblw->scroll_by_line.line_pointer && !force_redisp) return(move_thumb); else if ( new_line <= sblw->scroll_by_line.line_pointer) { if ( sblw->scroll_by_line.line_pointer - new_line >= num_lines || force_redisp) { XClearWindow(((child)->core.screen->display) ,((child)->core.window) ); y_pos = 0; start_line = new_line; num_lines_disp = num_lines; } else { lines_to_move = num_lines - sblw->scroll_by_line.line_pointer + new_line; y_location = sblw->scroll_by_line.line_pointer - new_line; XCopyArea(((vbar)->core.screen->display) ,((child)->core.window) ,((child)->core.window) , gc,0,0,child->core.width, (lines_to_move + 1) * sblw->scroll_by_line.font_height, 0,y_location * sblw->scroll_by_line.font_height); XClearArea( ((vbar)->core.screen->display) ,((child)->core.window) ,0,0,0, (num_lines - lines_to_move) * sblw->scroll_by_line.font_height, 0 ); y_pos = 0; start_line = new_line; num_lines_disp = num_lines - lines_to_move; } } else { if ( new_line - sblw->scroll_by_line.line_pointer >= num_lines || force_redisp) { XClearWindow(((child)->core.screen->display) ,((child)->core.window) ); y_pos = 0; start_line = new_line; num_lines_disp = num_lines; } else { lines_to_move = num_lines - new_line + sblw->scroll_by_line.line_pointer; y_location = new_line - sblw->scroll_by_line.line_pointer; XCopyArea(((vbar)->core.screen->display) ,((child)->core.window) ,((child)->core.window) ,gc,0, y_location * sblw->scroll_by_line.font_height, child->core.width, (lines_to_move)* sblw->scroll_by_line.font_height,0,0); lines_to_move--; XClearArea(((vbar)->core.screen->display) ,((child)->core.window) ,0,lines_to_move * sblw->scroll_by_line.font_height + (int) (.1 * (float) sblw->scroll_by_line.font_height),0,0,0 ); y_pos = lines_to_move * sblw->scroll_by_line.font_height; start_line = new_line + lines_to_move; num_lines_disp = num_lines - lines_to_move; } } sblw->scroll_by_line.line_pointer = new_line; sblw_struct = (ScrollByLineStruct *) malloc(sizeof(ScrollByLineStruct)); sblw_struct->location = y_pos; sblw_struct->start_line = start_line; sblw_struct->num_lines = num_lines_disp; XtCallCallbacks( (Widget) sblw, "callback" , (caddr_t) sblw_struct); XFreeGC((( (Widget) sblw)->core.screen->display) , gc); free(sblw_struct); return(move_thumb); }