🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1495

Re: Bug in gcc-2.3.3 found while compiling Tk-3.0

#1495
From: Jurgen Botz
Date: Tue, 29 Dec 1992 15:34
76 lines
3029 bytes
In article <BzzHI7.HIr@mtholyoke.edu> I reported a bug in gcc-2.3.3, but
I was advised by rms that my bug report did not contain enough information
to be useful.  Sorry about that... I submitted it after having not gotten
any sleep in over 30 hours and I was a little out of it.  Here's a more
detailed report with a self contained example (extracted from Tk3.0 by
John Ousterhout, available from sprite.berkeley.edu)

gcc is version 2.3.3, built on a DECstation 3100 under Ultrix 4.2 with
"configure mips-dec-ultrix".  The version used was installed from the
third stage compilation.

Compiling the included example with optimization ("gcc -O -c test.c")
produces the following error message:

   test.c: In function 'TkBezierScreenPoint':
   test.c:54: fp_offset (16) or end_offset (-4) is less than zero.

Compiling the same file with gcc 2.3.2 ("gcc -V 2.3.2 -O -c test.c")
or with gcc 2.3.3 without optimization produces no error.  Brief
testing of Tk-3.0 with tkTrig.c compiled with 2.3.2 and everything
else with 2.3.3 (optimization on in both cases) seems to indicate that
2.3.2 compiles and optimizes this function correctly.

- Jurgen Botz, jbotz@mtholyoke.edu

--------- snip ----------------------------------------------------

/*
** Excerpt from tkTrig.c, tkCanvas.h & Xlib.h
**
** Tk is copyright 91, 92, Regents of the Univ. of California
*/

typedef struct {
    short x, y;
} XPoint;

#define SCREEN_X(canvasPtr, x) \
	(((int) ((x) + 0.5)) - (canvasPtr)->drawableXOrigin)
#define SCREEN_Y(canvasPtr, y) \
	(((int) ((y) + 0.5)) - (canvasPtr)->drawableYOrigin)

typedef struct {
    /* ... */
    int drawableXOrigin, drawableYOrigin;
    /* ... */
} Tk_Canvas;


void
TkBezierScreenPoints(canvasPtr, control, numSteps, xPointPtr)
    Tk_Canvas *canvasPtr;		/* Canvas in which curve is to be
					 * drawn. */
    double control[];			/* Array of coordinates for four
					 * control points:  x0, y0, x1, y1,
					 * ... x3 y3. */
    int numSteps;			/* Number of curve points to
					 * generate.  */
    register XPoint *xPointPtr;		/* Where to put new points. */
{
    int i;
    double u, u2, u3, t, t2, t3;

    for (i = 1; i <= numSteps; i++, xPointPtr++) {
	t = ((double) i)/((double) numSteps);
	t2 = t*t;
	t3 = t2*t;
	u = 1.0 - t;
	u2 = u*u;
	u3 = u2*u;
	xPointPtr->x = SCREEN_X(canvasPtr, (control[0]*u3
		+ 3.0 * (control[2]*t*u2 + control[4]*t2*u) + control[6]*t3));
	xPointPtr->y = SCREEN_Y(canvasPtr, (control[1]*u3
		+ 3.0 * (control[3]*t*u2 + control[5]*t2*u) + control[7]*t3));
    }
}
Technical Details
Message-ID: <C011y6.8D4@mtholyoke.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!mtholyoke.EDU!jbotz
References: <BzzHI7.HIr@mtholyoke.edu>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!mtholyoke.EDU!jbotz
From: jbotz@mtholyoke.EDU (Jurgen Botz)
Subject: Re: Bug in gcc-2.3.3 found while compiling Tk-3.0
Message-ID: <C011y6.8D4@mtholyoke.edu>
Sender: gnulists@ai.mit.edu
Organization: Mount Holyoke College
References: <BzzHI7.HIr@mtholyoke.edu>
Distribution: gnu
Date: Tue, 29 Dec 1992 15:34:53 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 83