Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!kth!draken!ttds!jonasn From: jonasn@ttds.UUCP (Jonas Nygren) Newsgroups: comp.unix.ultrix Subject: Re: DS3100: buggy cc Message-ID: <1211@ttds.UUCP> Date: 6 Jun 89 14:36:33 GMT References: <1207@ttds.UUCP> Reply-To: jonasn@ttds.UUCP (Jonas Nygren) Organization: The Royal Inst. of Techn., Stockholm Lines: 60 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 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); }