DS3100: buggy cc
Jonas Nygren
jonasn at ttds.UUCP
Wed Jun 7 00:36:33 AEST 1989
I have not got any responses on my query yet and my problem remains. In the
meantime I have been able to extract the essence of the bug and put it into a
small example which is included below. What can possibly go wrong???
When prog, below, is run this is the result.
% prog
Segmentation fault (core dumped)
%
Why does XNextEvent overwrite yyy's return adress on the stack???
Any help is welcome.
Thanx in advance
---------------- Compile: cc -g2 prog.c -o prog -lX11
#include <X11/Xlib.h>
Display *display;
Screen *screen;
int screen_no;
Window rootwin;
typedef unsigned long color;
color black,white;
yyy()
{
do_nextevent();
}
main(){
Window w;
display = XOpenDisplay ("");
screen = XDefaultScreenOfDisplay (display);
screen_no = XDefaultScreen(display);
rootwin = XDefaultRootWindow (display);
black = XBlackPixelOfScreen (screen);
white = XWhitePixelOfScreen (screen);
w = XCreateSimpleWindow(display, rootwin,
100, 100, 300, 300, 0, black, white);
XSelectInput(display,w,ExposureMask);
XMapRaised(display,w);
yyy();
XDestroyWindow(display,w);
XCloseDisplay(display);
}
do_nextevent()
{
XAnyEvent e;
XNextEvent(display, &e);
}
More information about the Comp.unix.ultrix
mailing list