Freeze While Parsing Prelude

Jeff Binder <[email protected]>
Newsgroups gmane.comp.lang.haskell.hugs.bugs
Message-ID <[email protected]>
On my system (Gentoo Linux PPC, GCC 2.95.3), Hugs goes into an infinite 
loop while parsing the Prelude file. The problem is in input.c, lines 
515 and 516:

         lineBuffer[lineLength] = fgetc(inputStream);
         if (lineBuffer[lineLength] == EOF)

The value of EOF cannot be stored in a char on this system, so 
'lineBuffer[lineLength] == EOF' always evaluates to 0. Here's a fix:

         int ch = fgetc(inputStream);
         lineBuffer[lineLength] = ch;
         if (ch == EOF)

Glad to help,
Jeff Binder
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.