https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116047
Bug ID: 116047 Summary: C preprocessor bug Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor Assignee: unassigned at gcc dot gnu.org Reporter: ovidiu.panait at windriver dot com Target Milestone: --- When processing large header files, the C preprocessor reports error on the wrong line. This is 100% reproducible on my side with gcc mainline. Reproducer: # Build mkdir build; cd build ../configure --host=x86_64-pc-linux-gnu --target=x86_64-wrs-linux --enable-languages=c --disable-multilib --disable-libstdcxx-pch --disable-libsanitizer --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libgomp --disable-libvtv --disable-bootstrap make all-host -j$(nproc) mkdir install; make install-host DESTDIR=$(realpath ./install) -j$(nproc) # Generate testcase mkdir testcase; cd testcase cat > main.c <<EOF extern int main_begins; extern int main_begins; extern int main_begins; #include "header1.h" EOF echo -n > header1.h for i in {1..327676}; do echo "extern int header1_begins;" >> header1.h done cat >> header1.h <<EOF #include "header2.h" extern int header1 ends; EOF echo -n > header2.h # Test ../install/usr/local/bin/x86_64-wrs-linux-gcc main.c In file included from main.c:4: header1.h:327677:20: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ends’ 327677 | #include "header2.h" | ^ The line where the error is reported(327677) is bogus, the actual error is on the next line(327678) in header1.h: $ cat -n header1.h | tail -n3 327676 extern int header1_begins; 327677 #include "header2.h" 327678 extern int header1 ends;