On Wed, Nov 01, 2023 at 05:54:57PM -0400, Lewis Hyatt wrote:
> Since r14-2893, the frontend parser object needs to exist when running in
> preprocess-only mode, because pragma_lex() is now called in that mode and
> needs to make use of it. This is handled by calling c_init_preprocess() at
> startup. If -fpch-preprocess is in effect (commonly, because of
> -save-temps), a PCH file may be loaded during preprocessing, in which
> case the parser will be destroyed, causing the issue noted in the
> PR. Resolve it by reinitializing the frontend parser after loading the PCH.
> 
> gcc/c-family/ChangeLog:
> 
>       PR pch/112319
>       * c-ppoutput.cc (cb_read_pch): Reinitialize the frontend parser
>       after loading a PCH.
> 
> gcc/testsuite/ChangeLog:
> 
>       PR pch/112319
>       * g++.dg/pch/pr112319.C: New test.
>       * g++.dg/pch/pr112319.Hs: New test.
>       * gcc.dg/pch/pr112319.c: New test.
>       * gcc.dg/pch/pr112319.hs: New test.

LGTM.

        Jakub

Reply via email to