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

            Bug ID: 115255
           Summary: sibcall at -O0 causes ICE in df_refs_verify on arm
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andi-gcc at firstfloor dot org
  Target Milestone: ---

Note to trigger this bug need to modify tree-tailcall to run at -O0 (which is
done for musttail), e.g. by the patches here:
https://gcc.gnu.org/pipermail/gcc-patches/2024-May/thread.html#652312

On ARM targets with -O0 I see

int __attribute__((noinline,noclone,noipa))callee (int i);

int __attribute__((noinline,noclone,noipa))
caller (int i)
{
  [[gnu::musttail]] return callee (i + 1);
}

../musttail1.c: In function ‘caller’:
../musttail1.c:14:1: internal compiler error: in df_refs_verify, at
df-scan.cc:4022
   14 | }
      | ^
0x87d483 df_refs_verify
        ../../gcc/gcc/df-scan.cc:4022
0xaa7d56 df_insn_refs_verify
        ../../gcc/gcc/df-scan.cc:4101
0xaa996b df_bb_verify
        ../../gcc/gcc/df-scan.cc:4138
0xaa9ce7 df_scan_verify()
        ../../gcc/gcc/df-scan.cc:4259
0xa979c2 df_verify()
        ../../gcc/gcc/df-core.cc:1834
0xa97a2a df_analyze_1
        ../../gcc/gcc/df-core.cc:1221
0xa97c31 df_analyze()
        ../../gcc/gcc/df-core.cc:1305
0x12607f0 thumb2_reorg
        ../../gcc/gcc/config/arm/arm.cc:19392
0x127522b arm_reorg
        ../../gcc/gcc/config/arm/arm.cc:19611
0xea6eab execute
        ../../gcc/gcc/reorg.cc:3931


arm_reorg is just before sched2.

The assert happens because the REG/REGNO of the new df chain changes when it is
rebuilt (differs by one from the old). Presumably changed by ipa or reload
since there are very few passes at -O0. I'm not fully sure which data structure
is stale.

I tried to add the df_analyze in the same position on x86, but the problem is
not triggered there.

Reply via email to