andrew@isgtec.UUCP (Andrew) (10/30/89)
>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, but I end up with a segmentation >fault in highlighting something. I am currently trying to get TAE and >xrn6.0 up and running. Any help or hints would be appreciated. Oh yeah, >This is under Sun's OpenWindows 1.0 release. From another article: 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); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Try these fixes. I didn't have any problems after that. (PS. any more problems, please post a message to the net, since our mailer is down.) > Thanks, > Greg You're welcome! -- Andrew MacLean ...uunet!mnetor!lsuc!isgtec!andrew Success is a journey, not an adventure! ...utzoo!lsuc!isgtec!andrew ISG Technologies Inc. 3030 Orlando Dr. Mississauga. Ont. Can. L4V 1S8