On 11/26/13 13:25, Jakub Jelinek wrote:
Hi!

The problem on this testcase is that we have
(debug_insn 30 29 31 7 (var_location:HI D#1 (subreg:HI (reg/v:SI 93 [ p ]) 0)) 
pr59166.c:20 -1
      (nil))
and split_live_ranges_for_shrink_wrap decides to replace
SImode pseudo 93 with some other SImode pseudo.  But it
uses DF_REF_LOC, which is address of the HImode subreg around the pseudo,
validate_change succeeds on it, because there is no validation inside of
debug_insns and then we crash during var-tracking because of a mode
mismatch.

The following patch uses DF_REF_REAL_LOC instead, so that it looks through
the subreg and adjusts what it should.  Code inspection showed the same
issue in find_moveable_pseudos, don't have a testcase for that though.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2013-11-26  Jakub Jelinek  <ja...@redhat.com>

        PR rtl-optimization/59166
        * ira.c (find_moveable_pseudos): Use DF_REF_REAL_LOC instead of
        DF_REF_LOC in validate_change call.
        (split_live_ranges_for_shrink_wrap): Likewise.

        * gcc.dg/torture/pr59166.c: New test.
OK.
Jeff

Reply via email to