hugs98-Dec2001 on AIX

Sigbjorn Finne sof@galois.com
Fri, 28 Dec 2001 05:13:40 -0800


Hi there,

thanks very much for a fine bug report. The input.c change you
had to make has been reported a.ready & fixed in the current
sources (available via http://cvs.haskell.org/, btw)

Re: the C compiler configuration changes, I've introduced
configure script tests which I believe will catch and handle
your compilation setup correctly. If you're willing to, I could
send you the updated configure scripts for you to verify
this.

thanks,
--sigbjorn

----- Original Message -----
From: "James B. White III (Trey)" <whitejbiii@ornl.gov>
To: <hugs-bugs@haskell.org>
Sent: Friday, December 21, 2001 14:13
Subject: hugs98-Dec2001 on AIX


> Hugs debuggers,
>
> I built the December 2001 distribution of Hugs on AIX using IBM's C
> compiler, and it required a few changes to the distribution to work.
>
> System:
> AIX 4.3.3
> XL C 5.0.2
>
> To build without error, I had to change the value of "CFLAGS". I could
> not do this with "configure" because it was hardwired to set "CFLAGS =
> -g". I modified "configure" as follows, commenting out the hardwired
values.
>
> % diff configure.orig configure
> 4611,4612c4611,4612
> < CFLAGS="-g"
> < OPTFLAGS="-O2"
> ---
> > #CFLAGS="-g"
> > #OPTFLAGS="-O2"
>
> Then I configured with the following command. The "-qalloca" is required.
>
> CC=cc CFLAGS="-g -qalloca" OPTFLAGS="-O -qmaxmem=-1"
> LDFLAGS="-bmaxdata:0x70000000" configure --prefix=$MYPREFIX
>
> The resulting Hugs executable hung while parsing the Prelude. (The
> distribution from February 2001 did not have this problem.) I eventually
> discovered the root of the problem in "input.c". I made the following
> change to fix it.
>
> % diff input.c.orig input.c
> 516c516
> <         if (lineBuffer[lineLength] == EOF)
> ---
> >         if (lineBuffer[lineLength] == (char)EOF)
>
> With AIX, "EOF" is a signed integer of value -1, but characters are
> unsigned. When the character variable "lineBuffer[lineLength]" is set to
> "EOF", its value becomes 255. Since 255 doesn't equal -1, the "if"
> statement is never true. Casting "EOF" to a character give it the needed
> value of 255.
>
> Section 2.7 of K&R's C book, 2nd edition, describes the machine
> dependence of the automatic conversion of characters "up" to signed
> integers. The explicit "downward" cast avoids this machine dependence. I
> humbly suggest incorporating this change to "input.c" in future Hugs
distributions.
>
> --
> James B. White III (Trey)
> Center for Computational Sciences
> Oak Ridge National Laboratory
> whitejbiii@ornl.gov
>