Article View: gnu.gcc.bug
Article #1809bug in m68k gcc 1.30
From: Tom Quinn
Date: Mon, 17 Oct 1988 19:35
Date: Mon, 17 Oct 1988 19:35
133 lines
3990 bytes
3990 bytes
The following code compiles incorrectly with the "-O
-finline-functions" flags. This is gcc version 1.30 on a Sun 3/50
running SunOS 3.5.
Tom Quinn Canadian Institute for Theoretical Astrophysics
trq@moose.cita.utoronto.ca
UUCP - decvax!utgpu!moose!trq
BITNET - quinn@utorphys.bitnet
ARPA - trq%moose.cita.toronto.edu@relay.cs.net
The offending assembler:
LBB6:
.stabd 68,0,54
fmoves fp0,d0
.stabd 68,0,56
fcmps d2,fp0 # d2 is never set before this point !!
fjnlt L95
movel d2,d0
jra L96
L95:
fmoves d0,fp2
fcmps d3,fp2 # same with d3 !!
fjngt L97
movel d3,d0
The compile:
gcc -g -v -S -O -finline-functions -c Scroll.c
gcc version 1.30
/usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ -D__HAVE_68881__ -Dmc68020 Scroll.c /tmp/cca02017.cpp
GNU CPP version 1.30
/usr/local/lib/gcc-cc1 /tmp/cca02017.cpp -quiet -dumpbase Scroll.c -finline-functions -g -O -version -o Scroll.s
GNU C version 1.30 (68k, MIT syntax) compiled by GNU C version 1.30.
The code:
------------------------------------------------------------------------
typedef struct {
struct _XDisplay *display;
} Screen;
typedef struct _XDisplay {
int fd;
} Display;
typedef struct {
int type;
int x, y;
} XKeyEvent;
typedef struct {
int type;
int x, y;
} XButtonEvent;
typedef struct {
int type;
int x, y;
} XMotionEvent;
typedef struct {
int type;
int x, y;
} XCrossingEvent;
typedef union _XEvent {
int type;
XKeyEvent xkey;
XButtonEvent xbutton;
XMotionEvent xmotion;
XCrossingEvent xcrossing;
} XEvent;
typedef struct _WidgetRec *Widget;
typedef char Boolean;
typedef int Position;
typedef unsigned int Dimension;
typedef struct _CorePart {
Screen *screen;
Position x, y;
Dimension width, height;
} CorePart;
typedef struct _WidgetRec {
CorePart core;
} WidgetRec;
typedef enum {XtorientHorizontal, XtorientVertical} XtOrientation;
typedef struct _ScrollbarRec *ScrollbarWidget;
typedef struct {
XtOrientation orientation;
float top;
char direction;
} ScrollbarPart;
typedef struct _ScrollbarRec {
CorePart core;
ScrollbarPart scrollbar;
} ScrollbarRec;
static float FloatInRange(num, small, big)
float num, small, big;
{
return (num < small) ? small : ((num > big) ? big : num);
}
static float FractionLoc(w, x, y)
ScrollbarWidget w;
int x, y;
{
float result;
result = ((w->scrollbar.orientation == XtorientHorizontal) ? (float) x/w->core.width :
(float) y/w->core.height) ;
return FloatInRange(result, 0.0, 1.0);
}
static void ExtractPosition( event, x, y )
XEvent *event;
int *x, *y;
{
switch( event->type ) {
case 6 :
*x = event->xmotion.x; *y = event->xmotion.y; break;
case 4 :
case 5 :
*x = event->xbutton.x; *y = event->xbutton.y; break;
case 2 :
case 3 :
*x = event->xkey.x; *y = event->xkey.y; break;
case 7 :
case 8 :
*x = event->xcrossing.x; *y = event->xcrossing.y; break;
default:
*x = 0; *y = 0;
}
}
void MoveThumb( gw, event, params, num_params )
Widget gw;
XEvent *event;
{
ScrollbarWidget w = (ScrollbarWidget) gw;
Position x, y;
if (w->scrollbar.direction == 0) return;
ExtractPosition( event, &x, &y );
w->scrollbar.top = FractionLoc(w, x, y);
PaintThumb(w);
XFlush(((w)->core.screen->display) );
}
Technical Details
Message-ID:
<8810171935.AA05147@moose.cita.utoronto.ca>Path:
arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!moose.cita.utoronto.ca!trqShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!moose.cita.utoronto.ca!trq From: trq@moose.cita.utoronto.ca (Tom Quinn) Newsgroups: gnu.gcc.bug Subject: bug in m68k gcc 1.30 Message-ID: <8810171935.AA05147@moose.cita.utoronto.ca> Date: 17 Oct 88 19:35:41 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 133