Thread View: gnu.gcc.bug
2 messages
2 total messages
Started by Jurgen Botz
Mon, 28 Dec 1992 19:15
Bug in gcc-2.3.3 found while compiling Tk-3.0
Author: Jurgen Botz
Date: Mon, 28 Dec 1992 19:15
Date: Mon, 28 Dec 1992 19:15
39 lines
1759 bytes
1759 bytes
I was just compiling the latest release of John Ousterhout's Tcl/Tk
with gcc-2.3.3 when I got the following error in tkTrig.c:
tkTrig.c: In function 'TkBezierScreenPoint':
tkTric.c:798: fp_offset (16) or end_offset (-4) is less than zero.
gcc-2.3.2 compiles the same file without complaining. I don't have
the know-how or time to try to track this down right now, but I thought
I'd report it at least. In case it might be helpful, here's the
function...
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));
}
}
Re: Bug in gcc-2.3.3 found while compiling Tk-3.0
Author: Jurgen Botz
Date: Tue, 29 Dec 1992 15:34
Date: Tue, 29 Dec 1992 15:34
76 lines
3029 bytes
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));
}
}
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