preprocessor/2277: reader complains about input file larger than 8230 bytes

Neil Booth neil@daikokuya.demon.co.uk
Sun Apr 1 00:00:00 GMT 2001


The following reply was made to PR preprocessor/2277; it has been noted by GNATS.

From: Neil Booth <neil@daikokuya.demon.co.uk>
To: Peter.Zienicke@bln.siemens.de
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: preprocessor/2277: reader complains about input file larger than 8230 bytes
Date: Tue, 13 Mar 2001 19:09:48 +0000

 Peter.Zienicke@bln.siemens.de wrote:-
 
 > Reason is an apparent bug in source file cppfiles.c.
 > This allocates a buffer of length 8192 (+2+2).
 > Also, it calls read_and_prescan() with len==4096.
 > Then calls read() with length 8192 (pfile input buffer).
 > Read() returns with 38 read bytes which increases "offset"
 > to 38. Next loop calls read() again with length 8192.
 > This time read() returns 8192 read bytes which increases
 > "offset" to 8230. Now offset (==8230) is greater than
 > "len" (==4096), so "len" is doubled (to 8192). Still,
 > "offset" is larger than "len" which leads to the error
 > message complaining about a file that is larger than 8230
 > bytes.
 
 Wow, thanks for the analysis.
 
 The good news is that that code is long since dead.  Could
 you try a recent snapshot?  I suspect it has long since been
 fixed.
 
 Neil.



More information about the Gcc-prs mailing list