http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51271

--- Comment #14 from vries at gcc dot gnu.org 2011-12-17 12:49:21 UTC ---
Created attachment 26119
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26119
res_hconf.c.221r.mach, using Andrew's patch

(In reply to comment #13)
> I think my patch for PR 51471 will also fix this bug.  I now know why I could
> not reproduce it, I was using slightly different scheduling (-march=octeon
> rather than the default).

I tried out the patch, and the compiler does not assert any more. However, I'm
not convinced that it fixes the problem.

The patch inhibits scheduling of frame-related instructions in delay slots.
AFAIU, the instruction causing problems in this PR is insn 141, and it is not
marked as frame-related, so the patch has no direct effect on that instruction.

The patch seems to have the following effect: the frame-related insn 129 (from
the prologue) is inhibited from being scheduled into the delay slot of
jump_insn 60. So instead, insn 141 is now scheduled into the delay slot of
jump_insn 60. As a consequence insn 141 is now executed on both paths leading
up to block 8, and the assert is not triggered anymore.

rtl.h:
...
  /* 1 in an INSN or a SET if this rtx is related to the call frame,
     either changing how we compute the frame address or saving and
     restoring registers in the prologue and epilogue.
     <SNIP>.  */
  unsigned frame_related : 1;
...

given this definition, maybe insn 141 should be marked as frame-related, since
it restores a reg in the epilogue.

Reply via email to