gcc reports Internal Error

Zack Weinberg zack@codesourcery.com
Sat Jul 13 02:09:00 GMT 2002


On Fri, Jul 12, 2002 at 07:50:06AM +0100, Neil Booth wrote:
> 
> I've often wondered whether it might be worth reading chunks at a time,
> or at least supporting this behaviour.
> 
> Suppose we read in a chunk of size N.  If we can find the last newline,
> we can put a NUL after it (remembering what was there originally).
> If we can't find a newline, keep reading chunks until we do.  Because
> of the range of newlines we find, it's best to actually replace the first
> newline char in the last string of newline chars, if you see what I
> mean.
...

Right, that was roughly what I had imagined doing too.

But it occurs to me that the real reason we slurp the file all at once
is not to simplify the lexer - it's because we want to cache it in
memory in case we have to process it again.  Of course, that basically
never happens for the primary source file, but I like the way we can
use the same code for the primary source file and all #included
files...

(The primary source file does #include itself on occasion - see
enquire.c, for instance.)

zw



More information about the Gcc-bugs mailing list