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

            Bug ID: 123376
           Summary: [16 Regression] ICE in write_type when building
                    qt6-qtscxml with -flto -ffat-lto-objects since
                    r16-3821
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Since r16-3821-gb9fde0219f35cd5244f647c20c7b31b0395dbc5a we get with -O2 -flto
-ffat-lto-objects
/opt/notnfs/gcc-bisect/obj/gcc/cc1plus.r16-3821 -quiet -O2 -flto
-ffat-lto-objects -g qt6-qtscxml.ii
qt6-qtscxml.ii:13:8: internal compiler error: in write_type, at
cp/mangle.cc:2477
   13 |   void plugh (const int &);
      |        ^~~~~
0x30b7168 internal_error(char const*, ...)
        ../../gcc/diagnostic-global-context.cc:786
0x30c589f fancy_abort(char const*, int, char const*)
        ../../gcc/diagnostics/context.cc:1787
0x618d07 write_type
        ../../gcc/cp/mangle.cc:2477
0x6198ca write_type
        ../../gcc/cp/mangle.cc:2606
0x61c800 write_method_parms
        ../../gcc/cp/mangle.cc:3147
0x61c477 write_bare_function_type
        ../../gcc/cp/mangle.cc:3083
0x60fb98 write_encoding
        ../../gcc/cp/mangle.cc:960
0x60efde write_mangled_name
        ../../gcc/cp/mangle.cc:821
0x624836 mangle_decl_string
        ../../gcc/cp/mangle.cc:4570
0x62487b get_mangled_id
        ../../gcc/cp/mangle.cc:4586
0x624bb9 mangle_decl(tree_node*)
        ../../gcc/cp/mangle.cc:4624
0x16a2c85 decl_assembler_name(tree_node*)
        ../../gcc/tree.cc:851
0x174b4a2 make_decl_rtl(tree_node*)
        ../../gcc/varasm.cc:1541
0x17512a7 decode_addr_const
        ../../gcc/varasm.cc:3310
0x1751c86 const_hash_1
        ../../gcc/varasm.cc:3443
0x1751dc7 const_hash_1
        ../../gcc/varasm.cc:3473
0x1751b6f const_hash_1
        ../../gcc/varasm.cc:3429
0x1754426 lookup_constant_def(tree_node*)
        ../../gcc/varasm.cc:3976
0xb9449d cst_pool_loc_descr
        ../../gcc/dwarf2out.cc:18050
0xb974c9 loc_list_from_tree_1
        ../../gcc/dwarf2out.cc:19253
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.

on
template <typename T> void foo (void *, void *) { new T; }
using C = void (*) (void *, void *);
template <typename T> struct D { static constexpr C foo = ::foo <T>; };
struct E { void (*bar) (void *, void *); };
constexpr bool v = false;
template <typename T, typename> void baz () { E { D<T>::foo }; }
template <class, class, bool> struct F;
template <class R, class E> struct F <R, E, false> { static void qux () { baz
<R, E> (); } };
template <typename... T> void corge () { (F <T, void, v>::qux (), ...); }
template <auto S> struct G { int val = int (); };
struct H {
  virtual void garply ();
  void plugh (const int &);
  G <&H::plugh> h;
};
void fred () { corge <H> (); }

Reply via email to