🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Tom Quinn Tue, 04 Oct 1988 20:03
bug in m68k gcc 1.28
#1745
Author: Tom Quinn
Date: Tue, 04 Oct 1988 20:03
232 lines
7806 bytes
The following code causes gcc to get a fatal signal when compiled with
the "-O -fforce-mem -finline-functions" options.  This is gcc version
1.28 on a Sun3/50 running SunOS 3.5.

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 -fforce-mem -finline-functions -c Text.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 Text.c /tmp/cca22018.cpp
GNU CPP version 1.28
 /usr/local/lib/gcc-cc1 /tmp/cca22018.cpp -quiet -dumpbase Text.c -fforce-mem -finline-functions -g -O -version -o /tmp/cca22018.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 {
	struct _XDisplay *display; 
	Window root;		 
} Screen;
typedef struct _XDisplay {
	int fd;			 
} Display;
typedef union _XEvent {
        int type;		 
} XEvent;
typedef char *String;
typedef struct _WidgetRec *Widget;
typedef struct _WidgetClassRec *WidgetClass;
typedef unsigned int   Cardinal;
typedef char	Boolean;
typedef int		Position;    
typedef unsigned int	Dimension;   
typedef long XtArgVal;
extern Widget XtCreateManagedWidget ();
extern void XtRealizeWidget ();
extern Widget XtNameToWidget();  
typedef void (*XtCallbackProc)();
typedef struct _XtCallbackRec {
    XtCallbackProc  callback;
    caddr_t	    closure;
} XtCallbackRec;
extern char *XtMalloc();  
extern void XtFree();  
typedef struct {
    String	name;
    XtArgVal	value;
} Arg;
extern Widget XtCreatePopupShell();
typedef enum {XtGrabNone, XtGrabNonexclusive, XtGrabExclusive} XtGrabKind;
extern void XtPopup();
typedef struct _CorePart {
    Widget	    parent;		 
    String          name;		 
    Screen	    *screen;		 
    Window	    window;		 
    Position        x, y;		 
    Dimension       width;	 
    Dimension       border_width;	 
} CorePart;
typedef struct _WidgetRec {
    CorePart    core;
 } WidgetRec;
typedef struct _WidgetClassRec {
    int core_class;
} WidgetClassRec;
extern void XtMoveWidget();  
extern WidgetClass     commandWidgetClass;
extern WidgetClass dialogWidgetClass;
extern  WidgetClass transientShellWidgetClass;
int	strlen();
typedef struct _TextRec      *TextWidget;
typedef long XtTextPosition;
typedef struct _XtTextSource XtTextSourceRec, *XtTextSource;
typedef enum {XttextRead, XttextAppend, XttextEdit} XtTextEditType;
typedef struct {
    int  length;
    } XtTextBlock, *XtTextBlockPtr;
typedef struct _XtTextSource {
    XtTextEditType	edit_mode;
    };
typedef struct {
    XtTextPosition left, right;
} XtTextSelection;
typedef struct _TextPart {
    XtTextSource	source;
    XtTextPosition	insertPos;
    XtTextSelection	s;
    int			dialog_horiz_offset;  
    int			dialog_vert_offset;   
    Widget	    sbar;	     
    Boolean	    showposition;    
    struct _dialog {
	TextWidget  text;	     
	Widget      widget;	     
	Widget	    doit;	     
	Widget	    message;	     
	Boolean	    mapped;	     
	struct _dialog *next;	     
    } *dialog;			     
} TextPart;
typedef struct _TextRec {
    CorePart	core;
    TextPart	text;
} TextRec;
char *_XtTextGetText();
static DeleteOrKill(ctx, from, to, kill)
    TextWidget	   ctx;
    XtTextPosition from, to;
    Boolean	   kill;
{
    XtTextBlock text;
    char *ptr;
    if (kill && from < to) {
	ptr = _XtTextGetText(ctx, from, to);
	XStoreBuffer(((ctx)->core.screen->display) , ptr, strlen(ptr), 1);
	XtFree(ptr);
    }
    text.length = 0;
    if (ReplaceText(ctx, from, to, &text)) {
	XBell(((ctx)->core.screen->display) , 50);
	return;
    }
    _XtTextSetNewSelection(ctx, from, from);
    ctx->text.insertPos = from;
    ctx->text.showposition =  1 ;
}
static void DeleteCurrentSelection(ctx, event)
    TextWidget ctx;
   XEvent *event;
{
   StartAction(ctx, event);
    DeleteOrKill(ctx, ctx->text.s.left, ctx->text.s.right, 0 );
   EndAction(ctx);
}
void _XtTextAbortDialog();
static void DoInsert();
static void InsertFile(w, event)
    Widget w;
    XEvent *event;
{
    TextWidget ctx = (TextWidget)w;
    register struct _dialog *dialog, *prev;
    char *ptr;
    register Widget popup;
    static Arg popup_args[] = {
	{		"x" , 0 },
	{		"y" , 0 },
	{"iconName" , (XtArgVal)"Insert File:" },
	{"geometry" , 0 },
	{"allowShellResize" , 1 },
	{	"saveUnder" , 1 },
    };
    Arg args[2];
    static XtCallbackRec callbacks[] = { {0 , 0 }, {0 , 0 } };
    int x, y;
    Window j;
   StartAction(ctx, event);
    if (ctx->text.source->edit_mode != XttextEdit) {
	XBell(((w)->core.screen->display) , 50);
	EndAction(ctx);
	return;
    }
    if (ctx->text.s.left < ctx->text.s.right) {
	ptr = _XtTextGetText(ctx, ctx->text.s.left, ctx->text.s.right);
	DeleteCurrentSelection(ctx, (XEvent*)0 );
    }
    else {
	ptr = "";
    }
    XTranslateCoordinates( ((w)->core.screen->display) , ((w)->core.window) ,
			   ((((w)->core.screen) )->root) , 0, 0, &x, &y, &j );
    x += ctx->text.dialog_horiz_offset;
    y += ctx->text.dialog_vert_offset;
    if (ctx->text.sbar)
	x += ctx->text.sbar->core.width + ctx->text.sbar->core.border_width;
    prev = 0 ;
    for (dialog = ctx->text.dialog; dialog; dialog = dialog->next) {
	if (!dialog->mapped)
	    break;
	x += ctx->text.dialog_horiz_offset;
	y += ctx->text.dialog_vert_offset;
	prev = dialog;
    }
    if (dialog) {
	_XtTextAbortDialog(w, (caddr_t)dialog, 0 );
	XtMoveWidget(popup = dialog->widget->core.parent, x, y);
    }
    else {
	dialog = ((struct _dialog *) XtMalloc((unsigned) sizeof(struct _dialog))) ;
	if (prev)
	    prev->next = dialog;  
	else			  
	    ctx->text.dialog = dialog;
	dialog->text = ctx;
	dialog->message = (Widget)0 ;
	dialog->next = 0 ;
	popup_args[0].value = (XtArgVal)x;
	popup_args[1].value = (XtArgVal)y;
	popup = XtCreatePopupShell( "insertFile", transientShellWidgetClass, w,
				    popup_args, 	((Cardinal) (sizeof(popup_args) / sizeof(popup_args[0])))  );
	( ( args[0]).name = ( 	"label" ), ( args[0]).value = (XtArgVal)( "Insert File:"  ) ) ;
	( ( args[1]).name = ( 	"value" ), ( args[1]).value = (XtArgVal)( ptr ) ) ; 
	dialog->widget =
	    XtCreateManagedWidget("fileInsert", dialogWidgetClass, popup,
				  args, ((Cardinal)2) );
	XtSetKeyboardFocus( dialog->widget,
			    XtNameToWidget( dialog->widget, "value" ));
	callbacks[0].callback = _XtTextAbortDialog;
	callbacks[0].closure = (caddr_t)dialog;
	( ( args[0]).name = ( 	"callback" ), ( args[0]).value = (XtArgVal)( callbacks ) ) ;
	XtCreateManagedWidget( "Cancel", commandWidgetClass, dialog->widget,
			       args, ((Cardinal)1)  );
	callbacks[0].callback = DoInsert;
	dialog->doit =
	    XtCreateManagedWidget( "DoIt", commandWidgetClass, dialog->widget,
				   args, ((Cardinal)1)  );
	XtRealizeWidget( popup );
    }
    XtPopup(popup, XtGrabNone);
    dialog->mapped = 1 ;
   EndAction(ctx);
}
bug in sparc gcc 1.28
#1751
Author: Tom Quinn
Date: Wed, 05 Oct 1988 13:13
130 lines
4895 bytes
The following code causes gcc to get a fatal error if compiled with
the "-O" option.  This is on a Sun4/110 running SunOS 4.0.

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  -sun4 -c  nsat.c
gcc version 1.28
 /usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dsparc -Dsun -Dunix -D__OPTIMIZE__ nsat.c /tmp/cca00727.cpp
GNU CPP version 1.28
 /usr/local/lib/gcc-cc1 /tmp/cca00727.cpp -quiet -dumpbase nsat.c -g -O -version -o /tmp/cca00727.s
GNU C version 1.28 (sparc) compiled by GNU C version 1.28.

nsat.c:80: warning: floating point number exceeds range of `double'
gcc: Program cc1 got fatal signal 6.

The code:
------------------------------------------------------------------------
extern double fabs(), floor();
extern double sqrt();
extern double  pow();
extern double sin(), cos();
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;
main()
{
    struct sat *planet, test;	 
    int nplanet;
    int nsteps, i, print;
    double tmax, t;
    double p, deltay, gamma;
    double cphi, sphi;
    struct sat *sptr, *encptr, *nextpl();
    char *malloc();
    scanf("%d", &nplanet);
    if((planet = (struct sat *)malloc((unsigned) nplanet*sizeof(struct sat)))
       == 0 ) {
	exit(-1);
    }
    for(sptr = planet, i = 0; sptr < planet + nplanet; sptr++, i++) {
	scanf("%lf %lf %lf %lf", &(sptr->a), &(sptr->e), &(sptr->pomega),
	      &(sptr->mu));
	sptr->index = i;	 
	sptr->current = 0;	 
    }
    sptr = &test;
    scanf("%lf %lf %lf %lf", &(sptr->a), &(sptr->e), &(sptr->pomega),
	  &(sptr->mu));
    scanf("%d %d %lf %lf %lf", &nsteps, &print, &tmax, &t, &(sptr->phi));
    test.yr = test.e * cos(test.pomega);
    test.yi = test.e * sin(test.pomega);
    for(sptr = planet; sptr < planet + nplanet; sptr++) {
	sptr->p0 = (test.a - sptr->a)/sptr->a;
	sptr->n = 0;
	sptr->omega = pow(sptr->a, -1.5);
	sptr->phi = sptr->omega*t;
	sptr->phi -= (2.0*3.14 ) *(floor(sptr->phi/(2.0*3.14 ) ));
	sptr->yr = sptr->e * cos(sptr->pomega);
	sptr->yi = sptr->e * sin(sptr->pomega);
    }
    encptr = planet;
    for(i = 0; i < nsteps && t < tmax; i++) {
	test.omega = pow(test.a , -1.5);
	if(i % print == 0 && i != 0) {
	    double pphi = encptr->omega*3.14 /fabs(encptr->omega - test.omega);
	    pphi += test.phi;
	    cphi = cos(pphi);
	    sphi = sin(pphi);
	    printf("%g %g %g %.18g %g %d\n", test.a,
		   test.yr*cphi + test.yi*sphi,
		   -test.yr*sphi + test.yi*cphi, test.phi, t, encptr->index);
	}
	if((encptr = nextpl(planet, nplanet, test)) == 0 ) {  
	    break;
	}
	encptr->n++;
	test.phi += test.omega * dt;
	test.phi = drem(test.phi, (2.0*3.14 ) );
	if(test.phi < 0.0) test.phi = (2.0*3.14 )  + test.phi;
	test.phi -= (2.0*3.14 ) *(floor(test.phi/(2.0*3.14 ) ));
	for(sptr = planet; sptr < planet + nplanet; sptr++) {
	    sptr->phi += sptr->omega * dt;
	    sptr->phi = drem(sptr->phi, (2.0*3.14 ) );
	    if(sptr->phi < 0.0) sptr->phi = (2.0*3.14 )  + sptr->phi;
	    if(dt > 0.0) sptr->current = 0;
	}
	encptr->current++;
	t += dt;
	if(test.a > encptr->a)
	    deltay = encptr->mu * -2.23  /(encptr->p0 * encptr->p0);
	else
	    deltay = (-encptr->mu) * -2.23  /(encptr->p0 * encptr->p0);
	p = (test.a - encptr->a)/encptr->a;
	gamma = 0.75*((p)*(p))  - ((encptr->yr - test.yr)*(encptr->yr - test.yr)) 
	  - ((encptr->yi - test.yi)*(encptr->yi - test.yi)) ;
	test.yr += deltay*sin(test.phi);
	test.yi -= deltay*cos(test.phi);
	test.e = sqrt(((test.yr)*(test.yr))  + ((test.yi)*(test.yi)) );
	p = sqrt((4.0/3.0) * (gamma + ((test.yr - encptr->yr)*(test.yr - encptr->yr)) 
				    + ((test.yi - encptr->yi)*(test.yi - encptr->yi)) ));
	if(test.a > encptr->a)
	    test.a = encptr->a * (1.0 + p);
	else
	    test.a = encptr->a * (1.0 - p);
	if((test.a > encptr->a
	    && (1.0 - test.e)*test.a <= (1.0 + encptr->e)*encptr->a) 
	   || (test.a < encptr->a
	       && (1.0 + test.e)*test.a >= (1.0 - encptr->e)*encptr->a)) {
	    break;
	}
    }	
}
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads