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

            Bug ID: 128523
           Summary: [17 Regression] ICE on qt-6.12.0: ICE in
                    redirect_callee, at cgraph.cc:1750
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

Noticed ICE on `gcc-master` against `qt-6.12.0` from r17-6007-g2397b3b0422d72.

I had to apply 2 pending fixes to get to this ICE:
- PR128226
- PR128227

After applying both patches the ICE looks this way:

// $ cat qcbordiagnostic.cpp.cpp
template <typename _Container> auto data(_Container __cont) {
  return __cont.data();
}
enum GrowthPosition {};
template <typename C> bool q_points_into_range(const int **, C c) {
  bool __trans_tmp_7(data(c));
  return __trans_tmp_7;
}
struct QArrayDataPointer;
template <class> struct QPodArrayOps {
  QArrayDataPointer *that();
  template <typename Args> void emplace(Args) {
    GrowthPosition pos;
    that()->detachAndGrow(pos, 1, nullptr, nullptr);
  }
};
struct QArrayDataOps : QPodArrayOps<int> {
  QArrayDataOps *operator->();
};
int ptr;
bool detachAndGrow_detach;
void constAllocatedCapacity();
long size;
struct QArrayDataPointer {
  QArrayDataOps operator->();
  int *data() {
    int p;
    [&] { [[assume(p)]]; }();
    return &ptr;
  }
  void detachAndGrow(GrowthPosition, long, const int **data,
                     QArrayDataPointer *) {
    if (detachAndGrow_detach) {
      constAllocatedCapacity();
      freeSpaceAtEnd();
      if (size)
        data &&q_points_into_range(data, *this);
    }
  }
  void freeSpaceAtEnd();
} d;
void DiagnosticNotationappendValue() {
  d->emplace(d);
  d->emplace(d);
}

$ gcc/xg++ -Bgcc -c qcbordiagnostic.cpp.cpp -O2
during IPA pass: inline
qcbordiagnostic.cpp.cpp:45:1: internal compiler error: in redirect_callee, at
cgraph.cc:1750
   45 | }
      | ^
0x2e0379b diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x2df541d internal_error(char const*, ...)
        ???:0
0x2e00b84 fancy_abort(char const*, int, char const*)
        ???:0
0xe44619 cgraph_edge::redirect_callee(cgraph_node*)
        ???:0
0x115763f redirect_to_unreachable(cgraph_edge*)
        ???:0
0x115d54d edge_set_predicate(cgraph_edge*, ipa_predicate*)
        ???:0
0x115d707 ipa_call_summary_t::duplicate(cgraph_edge*, cgraph_edge*,
ipa_call_summary*, ipa_call_summary*)
        ???:0
0x116ea08 fast_call_summary<ipa_call_summary*,
va_heap>::symtab_duplication(cgraph_edge*, cgraph_edge*, void*)
        ???:0
0xe38e82 symbol_table::call_edge_duplication_hooks(cgraph_edge*, cgraph_edge*)
        ???:0
0xe52ccb cgraph_edge::clone(cgraph_node*, gcall*, unsigned int, profile_count,
profile_count, bool)
        ???:0
0xe55f27 cgraph_node::create_clone(tree_node*, profile_count, bool,
vec<cgraph_edge*, va_heap, vl_ptr>, bool, cgraph_node*, ipa_param_adjustments*,
char const*)
        ???:0
0x117c15b clone_inlined_nodes(cgraph_edge*, bool, bool, bool, int*)
        ???:0
0x117c3c5 clone_inlined_nodes(cgraph_edge*, bool, bool, bool, int*)
        ???:0
0x117e1e0 inline_call(cgraph_edge*, bool, vec<cgraph_edge*, va_heap, vl_ptr>*,
int*, bool, bool*)
        ???:0
0x2c2a5da (anonymous namespace)::pass_ipa_inline::execute(function*)
        ???: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
qcbordiagnostic.cpp.cpp -quiet -dumpbase qcbordiagnostic.cpp.cpp -dumpbase-ext
.cpp -mtune=generic -march=x86-64 -O2 -o
/tmp/nix-shell-674-214975336/ccRN2glb.s

$ 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 20261106 (experimental) (GCC)

Reply via email to