You're dead right Mike. This is totally broken and your fix is
absolutely spot on. Thanks you very much!
> the following:
>
> #define isSmall(c) (INTMIN<=(c)
> Cell mkInt(n) /* make cell representing integer */
> Int n; {
> return isSmall(INTZERO+n) ? INTZERO+n : pair(INTCELL,n);
> }
>
> results in undefined behavior if n is large enough to cause an
> overflow.
What I can't understand though is why it ever worked.
trying your example on Linux box, I have no problem at all
evaluating 0x7fffffff.
> P.S. I had to (filter (/= '\r')) parser.c to get it to compile.
Sigh, my instructions on how to build distributions
(hugs/src/distrib/README) explicitly say to do this - I guess I
forgot to do it.
In case you're wondering how they got there in the first place,
it's because most yacc implementations generate non-portable code.
The only yacc implementation we know of that generates portable code
runs only on the IBM-PC and, for all I know, is not available
in source form. So we always build the distribution version of
parser.c on a PC and so, naturally, it is riddled with carraige
returns. Sigh!
--
Alastair Reid Yale Haskell Project Hacker
[EMAIL PROTECTED] http://WWW.CS.Yale.EDU/homes/reid-alastair/