[comp.windows.x] Xt and SparcStation 1

gilley@ndl.COM (Greg Gilley) (10/19/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.
					Thanks,
					   Greg
-------------------------------------------------------
  Greg Gilley
  gilley@ndl.COM   [Numerical Design Limited]
  919-929-2917 (voice)

jim@EXPO.LCS.MIT.EDU (10/20/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,

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);
}

rusty@garnet.berkeley.edu (10/21/89)

In article <8910192213.AA02401@kanga.lcs.mit.edu> jim@EXPO.LCS.MIT.EDU writes:

   From: jim@EXPO.LCS.MIT.EDU
   Newsgroups: comp.windows.x
   Subject: Re: Xt and SparcStation 1
   Date: 19 Oct 89 22:13:17 GMT
   Organization: X Consortium, MIT Laboratory for Computer Science

       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.

What about using gcc?  Does it exhibit the same problem?
--

--------------------------------------
	rusty c. wright
	rusty@violet.berkeley.edu ucbvax!violet!rusty