Comment 17 for bug 809768

Revision history for this message
Richard Sandiford (rsandifo) wrote : Re: [Bug 809768] Re: Linaro GCC 4.6-2011.06-0 gets ICE when compiling bionic's libm

Ulrich Weigand <email address hidden> writes:
> The (reg:SI 95 d16 [orig:149 lx ] [149]) is generated by the
> cprop_hardreg pass substituting d16 for r2 inside a var_location debug
> insn.
>
> Of course, the regcprop.c code does perform the usual back-end checks:
>
> static bool
> mode_change_ok (enum machine_mode orig_mode, enum machine_mode new_mode,
> unsigned int regno ATTRIBUTE_UNUSED)
> {
> if (GET_MODE_SIZE (orig_mode) < GET_MODE_SIZE (new_mode))
> return false;
>
> #ifdef CANNOT_CHANGE_MODE_CLASS
> return !REG_CANNOT_CHANGE_MODE_P (regno, orig_mode, new_mode);
> #endif
>
> return true;
> }

We ought to be checking HARD_REGNO_MODE_OK as well. That's required
for correctness even on targets for which CANNOT_CHANGE_MODE_CLASS
is not defined.

CANNOT_CHANGE_MODE_CLASS is designed to be used in cases where mode
changes aren't allowed even though the old and new registers are
valid as far as HARD_REGNO_MODE_OK is concerned.

Richard