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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Slightly cleaned up testcase:
struct S s;
__builtin_va_list ap;
int i;
long long l;

struct S { int a; int b[]; };

struct S
foo (int x)
{
  struct S a = {};
  do
    if (x)
      return a;
  while (1);
}

void
bar (void)
{
  for (; i; i++)
    l |= __builtin_va_arg (ap, long long) << s.b[i];
  if (l)
    foo (l);
}

In fwprop1 we have:
(insn 81 80 82 7 (set (subreg:SI (reg:DI 35 [ _5 ]) 0)
        (reg:SI 65)) "pr101170.c":22:7 56 {*movsi_cf}
     (expr_list:REG_DEAD (reg:SI 65)
        (nil)))
(insn 82 81 44 7 (set (subreg:SI (reg:DI 35 [ _5 ]) 4)
        (reg:SI 66 [+4 ])) "pr101170.c":22:7 56 {*movsi_cf}
     (expr_list:REG_DEAD (reg:SI 66 [+4 ])
        (nil)))
(note, m68k is big endian).
and eventually
(debug_insn 65 64 66 10 (var_location:SI x (subreg:SI (reg:DI 35 [ _5 ]) 4))
"pr101170.c":24:5 -1
     (nil))
During cprop1 we get:
(debug_insn 84 80 81 8 (var_location:DI D#1 (clobber (const_int 0 [0]))) -1
     (nil))
(insn 81 84 83 8 (set (subreg:SI (reg:DI 35 [ _5 ]) 0)
        (reg:SI 65)) "pr101170.c":22:7 56 {*movsi_cf}
     (expr_list:REG_DEAD (reg:SI 65)
        (nil)))
(debug_insn 83 81 82 8 (var_location:DI D#1 (subreg:DI (reg:SI 66 [+4 ]) 0)) -1
     (nil))
(insn 82 83 44 8 (set (subreg:SI (reg:DI 35 [ _5 ]) 4)
        (reg:SI 66 [+4 ])) "pr101170.c":22:7 56 {*movsi_cf}
     (expr_list:REG_DEAD (reg:SI 66 [+4 ])
        (nil)))
...
(debug_insn 65 64 66 12 (var_location:SI x (subreg:SI (debug_expr:DI D#1) 4))
"pr101170.c":24:5 -1
     (nil))
out of this (which is very strange, because pseudo DI 35 which the D#1
supposedly stands for consist not just from the pseudo 66 (that is only lower
half) but also pseudo 65 (upper half).  So we have possible wrong-debug
somewhere.
Anyway, generally a paradoxical subreg of a reg is not wrong.
Later on reload sticks pseudo 66 into %d0 register, which shouldn't be wrong,
reload decisions shouldn't be affected by debug insns.
And at the end of reload (LRA?) df is computed and the new assertion doesn't
like that subreg, where regno becomes -1 (but unsigned).

Reply via email to