https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99023
Bug ID: 99023
Summary: [modules] ICE/SIGSEGV in module_state::write_define
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: boris at kolpackov dot net
Target Milestone: ---
Compiling the following two header units causes GCC to catch SIGSEGV in
module_state::write_define():
cat <<EOF >check.hxx
#pragma once
#include <string_view>
EOF
cat <<EOF >hello.hxx
#pragma once
#include <string_view>
import "check.hxx";
EOF
g++ -std=c++2a -fmodules-ts -fmodule-header -x c++-header check.hxx
g++ -std=c++2a -fmodules-ts -fmodule-header -x c++-header hello.hxx
hello.hxx: internal compiler error: Segmentation fault
0x1809473 crash_signal
../../gcc/gcc/toplev.c:327
0xc65ccc module_state::write_define(bytes_out&, cpp_macro const*, bool)
../../gcc/gcc/cp/module.cc:16374
0xc66f09 module_state::write_macros(elf_out*, cpp_reader*, unsigned int*)
../../gcc/gcc/cp/module.cc:16870
0xc69d65 module_state::write(elf_out*, cpp_reader*)
../../gcc/gcc/cp/module.cc:17747
0xc6ffe9 finish_module_processing(cpp_reader*)
../../gcc/gcc/cp/module.cc:19778
0xb8e905 c_parse_final_cleanups()
../../gcc/gcc/cp/decl2.c:5178
0xf10f4c c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1240