Path: utzoo!censor!geac!jtsv16!uunet!seismo!ukma!tut.cis.ohio-state.edu!bloom-beacon!EXPO.LCS.MIT.EDU!jim From: jim@EXPO.LCS.MIT.EDU Newsgroups: comp.windows.x Subject: Re: Xt and SparcStation 1 Message-ID: <8910192213.AA02401@kanga.lcs.mit.edu> Date: 19 Oct 89 22:13:17 GMT References: <8910191235.AA08289@orzo.ndl.com> Organization: X Consortium, MIT Laboratory for Computer Science Lines: 44 Has anyone been successful in getting the Xt toolkit up and running on a SparcStation? I've run into a problem where the optimizer seems to be generating bogus code. By compiling it debuggable, I can get around the initial problem which is in ParseRepeat, The problem rears its ugly head in all of the procedures that return a parameter that was never referenced. Instead of returning the string, the compiler seems to be returning whatever what the last value computed. There are two solutions that we've used here: (1) Don't compile TMparse.c with the optimizer (this is why there was some weirdness in the Xt Imakefile). (2) Stick a static String variable into TMparse.c and replace the "return str" in various routines to call a magic macro: #ifdef sparc /* * The silly optimizer in SunOS 4.0.3 and below generates bogus code that * causes the value of the most recently used variable to be returned instead * of the value passed in. */ static String silly_optimizer_kludge; #define BROKEN_OPTIMIZER_HACK(val) silly_optimizer_kludge = (val) #else #define BROKEN_OPTIMIZER_HACK(val) val #endif So, for example, ParseImmed ends up looking like the following: static String ParseImmed(str, closure, event,error) register String str; register Opaque closure; register EventPtr event; Boolean* error; { event->event.eventCode = (unsigned long)closure; event->event.eventCodeMask = (unsigned long)~0L; return BROKEN_OPTIMIZER_HACK(str); }