https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93761

            Bug ID: 93761
           Summary: ICE when compiling a standard header as a header unit
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cjdb.ns at gmail dot com
  Target Milestone: ---

Attempts to compile `<algorithm>` and `<iterator>` as header units cause GCC to
segfault. I'm aware that there are fewer headers that can be successfully
compiled as a header unit, but I can't find a ticket to track that it causes an
ICE otherwise.

* Branch: devel/c++-modules

* Hash: 50974764f8eaf583a94b08af27f51d604ede644c

* GCC configured with: ../gcc/configure --disable-nls --disable-multilib
--enable-languages=c,c++ --disable-werror --prefix=/opt/gcc-modules

* GCC built with: CFLAGS='-O3 -g0 -w' CXXFLAGS='-O3 -g0 -w'
LDFLAGS='-fuse-ld=gold'

* System: Ubuntu 18.04 (WSL)

* GCC invocation: /opt/gcc-modules/bin/g++ -std=c++2a -fmodule-header -c -x
c++-header /opt/gcc-modules/include/c++/10.0.1/algorithm

* Output:

```
algorithm.ii:1: internal compiler error: Segmentation fault
    1 | # 0 "/opt/gcc-modules/include/c++/10.0.1/algorithm"
      |
0x1068dcf crash_signal
        ../../gcc/gcc/toplev.c:332
0xa08460 hash_table<module_state_hash, false,
xcallocator>::find_slot_with_hash(std::pair<tree_node*, unsigned long> const&,
unsigned int, insert_option)
        ../../gcc/gcc/hash-table.h:963
0x9f116a get_module_slot
        ../../gcc/gcc/cp/module.cc:12397
0x9f11c5 get_module(tree_node*, module_state*, bool)
        ../../gcc/gcc/cp/module.cc:12422
0x9f4189 module_begin_main_file(cpp_reader*, line_maps*, line_map_ordinary
const*)
        ../../gcc/gcc/cp/module.cc:18278
0xb79988 cb_file_change
        ../../gcc/gcc/c-family/c-opts.c:1590
0x1adbf99 _cpp_stack_file
        ../../gcc/libcpp/files.c:995
0x1ade106 cpp_read_main_file(cpp_reader*, char const*, bool)
        ../../gcc/libcpp/init.c:689
0xb7b9bb c_common_post_options(char const**)
        ../../gcc/gcc/c-family/c-opts.c:1128
0x8d23c6 process_options
        ../../gcc/gcc/toplev.c:1388
0x8d23c6 do_compile
        ../../gcc/gcc/toplev.c:2199
We are damaged, This is broken.
Logic is lost,
We struggle,
Hunt through the rubble for what once was.
See <https://gcc.gnu.org/wiki/cxx-modules#Bugs> for instructions.
```

Reply via email to