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

            Bug ID: 125022
           Summary: [17 Regression] ICE on qtwebengine-6.11.0: in
                    tsubst_stmt, at cp/pt.cc:20843
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

Noticed ICE on qtwebengine-6.11.0 on r17-91-gafbf84bc904012, did not bisect
yet.

`cvise` produced the following reproducer:

// $ cat a.cc
struct raw_ptr {
  raw_ptr(int *);
};
struct [[clang::trivial_abi]] scoped_refptr {
  ~scoped_refptr();
  template <typename...> void emplace(scoped_refptr) {}
} main_thread_, AsyncMemoryConsumerRegistration_main_task_runner;
struct AsyncMemoryConsumerRegistration {
  AsyncMemoryConsumerRegistration();
  raw_ptr consumer_;
};
int AsyncMemoryConsumerRegistration_consumer;
AsyncMemoryConsumerRegistration::AsyncMemoryConsumerRegistration()
    : consumer_(&AsyncMemoryConsumerRegistration_consumer) {
  main_thread_.emplace(AsyncMemoryConsumerRegistration_main_task_runner);
}

Crashing:

$ gcc/xg++ -Bgcc -c a.cc
a.cc: In instantiation of ‘void scoped_refptr::emplace(scoped_refptr) [with
<template-parameter-1-1> = {}; scoped_refptr = scoped_refptr]’:
a.cc:15:23:   required from here
   15 |  
main_thread_.emplace(AsyncMemoryConsumerRegistration_main_task_runner);
      |  
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:6:54: internal compiler error: in tsubst_stmt, at cp/pt.cc:20843
    6 |   template <typename...> void emplace(scoped_refptr) {}
      |                                                      ^
0x2a05880 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x29f7a94 internal_error(char const*, ...)
        ???:0
0x2a02db7 fancy_abort(char const*, int, char const*)
        ???:0
0xb38f02 tsubst_stmt(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xb3a800 instantiate_body(tree_node*, tree_node*, tree_node*, bool)
        ???:0
0xb3b5f0 instantiate_decl(tree_node*, bool, bool)
        ???:0
0xb9d93f instantiate_pending_templates(int)
        ???:0
0x9a2317 c_parse_final_cleanups()
        ???:0
0xcfbeab c_common_parse_file()
        ???:0
gcc/cc1plus -quiet -iprefix /tmp/gb/gcc/../lib/gcc/x86_64-pc-linux-gnu/17.0.0/
-isystem gcc/include -isystem gcc/include-fixed -D_GNU_SOURCE a.cc -quiet
-dumpbase a.cc -dumpbase-ext .cc -mtune=generic -march=x86-64 -o
/tmp/nix-shell-4125285-163867136/ccs7LYPd.s
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.

$ gcc/xg++ -Bgcc -v
Reading specs from gcc/specs
COLLECT_GCC=gcc/xg++
COLLECT_LTO_WRAPPER=gcc/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/slyfox/dev/git/gcc/configure --disable-multilib
--disable-bootstrap --disable-lto --disable-libsanitizer
--enable-languages=c,c++ CFLAGS='-O1 -g0' CXXFLAGS='-O1 -g0' LDFLAGS='-O1 -g0'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 17.0.0 20260426 (experimental) (GCC)

Reply via email to