[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    [Bug pch/112319] New: segfault with pch and #pragma GCC diagnostic
From:       "krebbel at gcc dot gnu.org via Gcc-bugs" <gcc-bugs () gcc ! gnu ! org>
Date:       2023-10-31 17:14:12
Message-ID: bug-112319-4 () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]

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=
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic