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

            Bug ID: 125361
           Summary: ICE in gen_enumeration_type_die with modules and
                    forward declared enums
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mawww at kakoune dot org
  Target Milestone: ---

Created attachment 64481
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64481&action=edit
Source files for reproduction, including build.sh script and modules-map file.

With the following files:

fwd_e.cc
```
export module foo:fwd_e;

export enum class E;
```

e.cc
```
export module foo:e;

export enum class E { A };
export void f(E);
```

bug.cc
```
export module foo:bug;

import :fwd_e;
import :e;

export void f(E) {}
```

building bug.cc triggers this ICE:
bug.cc:6:15: internal compiler error: in gen_enumeration_type_die, at
dwarf2out.cc:23339
    6 | export void f(E) {}
      |               ^
0x2c2067e internal_error(char const*, ...)
        ../../gcc/gcc/diagnostic-global-context.cc:787
0xb11f49 fancy_abort(char const*, int, char const*)
        ../../gcc/gcc/diagnostics/context.cc:1813
0x8d5473 gen_enumeration_type_die
        ../../gcc/gcc/dwarf2out.cc:23339
0x109720e gen_tagged_type_die
        ../../gcc/gcc/dwarf2out.cc:26748
0x1098c6a gen_tagged_type_die
        ../../gcc/gcc/dwarf2out.cc:26708
0x1098c6a gen_type_die_with_usage
        ../../gcc/gcc/dwarf2out.cc:26947
0x109514b gen_type_die
        ../../gcc/gcc/dwarf2out.cc:27009
0x109514b gen_decl_die
        ../../gcc/gcc/dwarf2out.cc:27650
0x10966a8 dwarf2out_decl
        ../../gcc/gcc/dwarf2out.cc:28227
0x10969a7 dwarf2out_type_decl
        ../../gcc/gcc/dwarf2out.cc:27945
0x10969a7 dwarf2out_type_decl
        ../../gcc/gcc/dwarf2out.cc:27940
0x14aff7c rest_of_type_compilation(tree_node*, int)
        ../../gcc/gcc/passes.cc:345
0xcd7c41 module_state::read_cluster(unsigned int)
        ../../gcc/gcc/cp/module.cc:17743
0xcd878f module_state::load_section(unsigned int, binding_slot*)
        ../../gcc/gcc/cp/module.cc:21579
0xcd896e lazy_load_binding(unsigned int, tree_node*, tree_node*, binding_slot*)
        ../../gcc/gcc/cp/module.cc:22645
0xcf183b name_lookup::search_namespace_only(tree_node*)
        ../../gcc/gcc/cp/name-lookup.cc:921
0xcf32a3 name_lookup::search_unqualified(tree_node*, cp_binding_level*)
        ../../gcc/gcc/cp/name-lookup.cc:1151
0xcf7878 lookup_name(tree_node*, LOOK_where, LOOK_want)
        ../../gcc/gcc/cp/name-lookup.cc:8425
0xd0e461 lookup_name(tree_node*, LOOK_want)
        ../../gcc/gcc/cp/name-lookup.h:451
0xd0e461 cp_parser_lookup_name
        ../../gcc/gcc/cp/parser.cc:35531

Reply via email to