[Bug pch/115312] [14/15 Regression] ICE when including a PCH via compiler option -include since r14-5836
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jul 3 02:34:38 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115312
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Lewis Hyatt <lhyatt@gcc.gnu.org>:
https://gcc.gnu.org/g:038d64f62271ddc62aa35d0a5dfd3843fdb9e6d7
commit r15-1803-g038d64f62271ddc62aa35d0a5dfd3843fdb9e6d7
Author: Lewis Hyatt <lhyatt@gmail.com>
Date: Sat Jun 15 21:09:01 2024 -0400
preprocessor: Create the parser before handling command-line includes
[PR115312]
Since r14-2893, we create a parser object in preprocess-only mode for the
purpose of parsing #pragma while preprocessing. The parser object was
formerly created after calling c_finish_options(), which leads to problems
on platforms that don't use stdc-predef.h (such as MinGW, as reported in
the PR). On such platforms, the call to c_finish_options() will process
the first command-line-specified include file. If that includes a PCH, then
c-ppoutput.cc will encounter a state it did not anticipate. Fix it by
creating the parser prior to calling c_finish_options().
gcc/c-family/ChangeLog:
PR pch/115312
* c-opts.cc (c_common_init): Call c_init_preprocess() before
c_finish_options() so that a parser is available to process any
includes specified on the command line.
gcc/testsuite/ChangeLog:
PR pch/115312
* g++.dg/pch/pr115312.C: New test.
* g++.dg/pch/pr115312.Hs: New test.
More information about the Gcc-bugs
mailing list