Re: Compiler problem
gehring@inf.ethz.ch
Mon, 19 Aug 1996 15:34:25 +0200
al@sarah.lerc.nasa.gov writes:
> >Hi all,
> >The following program puts my compiler into an endless loop:
> >=========================================================
> >MODULE PrivColorTest;
> > IMPORT Ports, Out;
> >
> > PROCEDURE OutColor* (c: Ports.Color);
> > BEGIN
> > CASE c OF
> > Ports.black: Out.String("black")|
> > Ports.red: Out.String("red")|
> > Ports.green: Out.String("green")|
> > Ports.blue: Out.String("blue")
> > ELSE
> > Out.String("other")
> > END
> > END OutColor;
> >
> >END PrivColorTest.
> >=========================================================
> >but it will compile ok if I omit the last (blue) case. I
> >am using version 1.2.1 on a PowerMac. Can someone test
> >whether it gives the compiler problems on your system?
>
> I observe the same behavior. I am using vs 1.2.1, too,
> but under Windows NT. Did you notice the *size* of your
> Code file, it's HUGE for the size of this module. Mine
> was about 264k when the line
> Porst.blue: Out.String("blue")
> was removed. Interesting!
Offhand, I'd say that this compiler behaviour is due to the values of the
constants (are these RGB values?).
The compiler probably generates a huge jump table for these constants...
... my guess is that if you use a simple if statement instead, everything
will work fine and the object code size will be small.
-- Stephan
------------------------------------------------------------------------------
Stephan Gehring Email: gehring@inf.ethz.ch
Institute for Computer Systems Phone: +41 1 632 73 15
ETH-Zentrum FAX: +41 1 632 13 07
CH-8092 Zurich, Switzerland