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

            Bug ID: 104813
           Summary: ICE on valid code at -O3 on x86_64-linux-gnu: in
                    adjust_references_in_caller, at ipa-cp.cc:4963
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

It appears to be a recent regression.

[550] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220307 (experimental) [master r12-7507-gaad3d935189] (GCC) 
[551] % 
[551] % gcctk -O2 small.c; ./a.out
[552] % 
[552] % gcctk -O3 small.c
during IPA pass: cp
small.c:29:1: internal compiler error: in adjust_references_in_caller, at
ipa-cp.cc:4963
   29 | }
      | ^
0x1c6da79 adjust_references_in_caller
        ../../gcc-trunk/gcc/ipa-cp.cc:4963
0x1c6db04 adjust_refs_in_act_callers
        ../../gcc-trunk/gcc/ipa-cp.cc:4912
0x8afd26 cgraph_node::call_for_symbol_thunks_and_aliases(bool (*)(cgraph_node*,
void*), void*, bool, bool)
        ../../gcc-trunk/gcc/cgraph.cc:2447
0x1c6d969 adjust_references_in_caller
        ../../gcc-trunk/gcc/ipa-cp.cc:4994
0x1c70f63 create_specialized_node
        ../../gcc-trunk/gcc/ipa-cp.cc:5124
0x1c74530 decide_whether_version_node
        ../../gcc-trunk/gcc/ipa-cp.cc:6238
0x1c757fb ipcp_decision_stage
        ../../gcc-trunk/gcc/ipa-cp.cc:6354
0x1c757fb ipcp_driver
        ../../gcc-trunk/gcc/ipa-cp.cc:6542
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.
[553] % 
[553] % cat small.c
int a, b, c, d, *e;
void f(int h) {
  if (b) {
    int g;
    while (g++)
      d = *e;
    e++;
  }
}
static void i();
static void j(int *h, int k, int *l) {
  if (c) {
    int *o = h, m;
    f(*l);
    i(m);
    j(o, 1, o);
    for (;;)
      ;
  }
}
void i() {
  int *n = &a;
  while (1)
    j(n, 1, n);
}
int main() {
  j(&a, 0, &a);
  return 0;
}

Reply via email to