public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug pch/112319] New: segfault with pch and #pragma GCC diagnostic
@ 2023-10-31 17:14 krebbel at gcc dot gnu.org
2023-10-31 17:58 ` [Bug pch/112319] " lhyatt at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: krebbel at gcc dot gnu.org @ 2023-10-31 17:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112319
Bug ID: 112319
Summary: segfault with pch and #pragma GCC diagnostic
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: pch
Assignee: unassigned at gcc dot gnu.org
Reporter: krebbel at gcc dot gnu.org
Target Milestone: ---
touch s.h
touch u.h
main.cpp:
#include "s.h"
#include "u.h"
g++ s.h
g++ -c main.cpp --save-temps
In file included from main.cpp:2:
u.h:1:9: internal compiler error: Segmentation fault
1 | #pragma GCC diagnostic
| ^~~
0x1764fbf crash_signal
/home/andreas/build/../gcc/gcc/toplev.cc:314
0x10201cd maybe_read_tokens_for_pragma_lex
/home/andreas/build/../gcc/gcc/cp/parser.cc:49713
0x10201cd pragma_lex(tree_node**, unsigned int*)
/home/andreas/build/../gcc/gcc/cp/parser.cc:49735
0x11a962c pragma_diagnostic_lex
/home/andreas/build/../gcc/gcc/c-family/c-pragma.cc:851
0x11a9d78 handle_pragma_diagnostic_impl<true, true>
/home/andreas/build/../gcc/gcc/c-family/c-pragma.cc:879
0x11a9d78 handle_pragma_diagnostic_early_pp
/home/andreas/build/../gcc/gcc/c-family/c-pragma.cc:1039
0x11abdbd c_pp_invoke_early_pragma_handler(unsigned int)
/home/andreas/build/../gcc/gcc/c-family/c-pragma.cc:1769
0x11a8180 token_streamer::stream(cpp_reader*, cpp_token const*, unsigned int)
/home/andreas/build/../gcc/gcc/c-family/c-ppoutput.cc:293
0x11a8461 scan_translation_unit
/home/andreas/build/../gcc/gcc/c-family/c-ppoutput.cc:351
0x11a8461 preprocess_file(cpp_reader*)
/home/andreas/build/../gcc/gcc/c-family/c-ppoutput.cc:106
0x11a693d c_common_init()
/home/andreas/build/../gcc/gcc/c-family/c-opts.cc:1236
0xfa35be cxx_init()
/home/andreas/build/../gcc/gcc/cp/lex.cc:338
0xe94153 lang_dependent_init
/home/andreas/build/../gcc/gcc/toplev.cc:1816
0xe94153 do_compile
/home/andreas/build/../gcc/gcc/toplev.cc:2111
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Can be reproduced on x86 and s390x since:
e664ea960a200aac88ffc3c7fb9fe55ea4df2011 is the first bad commit
commit e664ea960a200aac88ffc3c7fb9fe55ea4df2011
Author: Lewis Hyatt <lhyatt@gmail.com>
Date: Fri Jun 30 18:23:24 2023 -0400
c-family: Implement pragma_lex () for preprocess-only mode
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug pch/112319] segfault with pch and #pragma GCC diagnostic
2023-10-31 17:14 [Bug pch/112319] New: segfault with pch and #pragma GCC diagnostic krebbel at gcc dot gnu.org
@ 2023-10-31 17:58 ` lhyatt at gcc dot gnu.org
2023-10-31 17:58 ` [Bug pch/112319] [14 Regression] " pinskia at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: lhyatt at gcc dot gnu.org @ 2023-10-31 17:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112319
Lewis Hyatt <lhyatt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lhyatt at gcc dot gnu.org
Last reconfirmed| |2023-10-31
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #1 from Lewis Hyatt <lhyatt at gcc dot gnu.org> ---
Thanks, I see it (with u.h containing a #pragma GCC diagnostic as its first
line). Will sort that out.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug pch/112319] [14 Regression] segfault with pch and #pragma GCC diagnostic
2023-10-31 17:14 [Bug pch/112319] New: segfault with pch and #pragma GCC diagnostic krebbel at gcc dot gnu.org
2023-10-31 17:58 ` [Bug pch/112319] " lhyatt at gcc dot gnu.org
@ 2023-10-31 17:58 ` pinskia at gcc dot gnu.org
2023-11-01 21:56 ` lhyatt at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-31 17:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112319
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
Summary|segfault with pch and |[14 Regression] segfault
|#pragma GCC diagnostic |with pch and #pragma GCC
| |diagnostic
Keywords| |ice-on-valid-code
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug pch/112319] [14 Regression] segfault with pch and #pragma GCC diagnostic
2023-10-31 17:14 [Bug pch/112319] New: segfault with pch and #pragma GCC diagnostic krebbel at gcc dot gnu.org
2023-10-31 17:58 ` [Bug pch/112319] " lhyatt at gcc dot gnu.org
2023-10-31 17:58 ` [Bug pch/112319] [14 Regression] " pinskia at gcc dot gnu.org
@ 2023-11-01 21:56 ` lhyatt at gcc dot gnu.org
2023-11-02 8:29 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: lhyatt at gcc dot gnu.org @ 2023-11-01 21:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112319
--- Comment #2 from Lewis Hyatt <lhyatt at gcc dot gnu.org> ---
Patch sent for review:
https://gcc.gnu.org/pipermail/gcc-patches/2023-November/634931.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug pch/112319] [14 Regression] segfault with pch and #pragma GCC diagnostic
2023-10-31 17:14 [Bug pch/112319] New: segfault with pch and #pragma GCC diagnostic krebbel at gcc dot gnu.org
` (2 preceding siblings ...)
2023-11-01 21:56 ` lhyatt at gcc dot gnu.org
@ 2023-11-02 8:29 ` rguenth at gcc dot gnu.org
2023-11-24 21:26 ` cvs-commit at gcc dot gnu.org
2023-11-24 21:27 ` lhyatt at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-02 8:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112319
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug pch/112319] [14 Regression] segfault with pch and #pragma GCC diagnostic
2023-10-31 17:14 [Bug pch/112319] New: segfault with pch and #pragma GCC diagnostic krebbel at gcc dot gnu.org
` (3 preceding siblings ...)
2023-11-02 8:29 ` rguenth at gcc dot gnu.org
@ 2023-11-24 21:26 ` cvs-commit at gcc dot gnu.org
2023-11-24 21:27 ` lhyatt at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-24 21:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112319
--- Comment #3 from CVS 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:5d4abd9219dfa53b52b341255e99139bb6cad302
commit r14-5836-g5d4abd9219dfa53b52b341255e99139bb6cad302
Author: Lewis Hyatt <lhyatt@gmail.com>
Date: Wed Nov 1 13:01:12 2023 -0400
preprocessor: Reinitialize frontend parser after loading a PCH [PR112319]
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug pch/112319] [14 Regression] segfault with pch and #pragma GCC diagnostic
2023-10-31 17:14 [Bug pch/112319] New: segfault with pch and #pragma GCC diagnostic krebbel at gcc dot gnu.org
` (4 preceding siblings ...)
2023-11-24 21:26 ` cvs-commit at gcc dot gnu.org
@ 2023-11-24 21:27 ` lhyatt at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: lhyatt at gcc dot gnu.org @ 2023-11-24 21:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112319
Lewis Hyatt <lhyatt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #4 from Lewis Hyatt <lhyatt at gcc dot gnu.org> ---
Fixed now.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-11-24 21:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-31 17:14 [Bug pch/112319] New: segfault with pch and #pragma GCC diagnostic krebbel at gcc dot gnu.org
2023-10-31 17:58 ` [Bug pch/112319] " lhyatt at gcc dot gnu.org
2023-10-31 17:58 ` [Bug pch/112319] [14 Regression] " pinskia at gcc dot gnu.org
2023-11-01 21:56 ` lhyatt at gcc dot gnu.org
2023-11-02 8:29 ` rguenth at gcc dot gnu.org
2023-11-24 21:26 ` cvs-commit at gcc dot gnu.org
2023-11-24 21:27 ` lhyatt at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).