Deadly optimization bug (all gcc versions!)

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Tue Aug 17 16:28:00 GMT 1999


Am Mit, 18 Aug 1999 schrieb Joern Rennecke:
>> I believe that in this case something like XVECEXP(x,i,1) is needed in the
>> SUBST() instead of the XEXP(x,i). But I have no idea what to check for a
>
>No.  The objective of this piece of code is to process XEXP(x, i) .
>The problem is that an incorrect value for new has been calculated.
>Find out why.

Hmm, I assume because simplify_rtx does the following:

3200                  SUBST (XEXP (x, i), new);
(gdb)
3115          for (i = 0; i < len; i++)
(gdb) p debug_rtx(x)

(plus:SI (lshiftrt:SI (reg/v:SI 84)
        (const_int 1 [0x1]))
    (lshiftrt:SI (reg:SI 3 r3)
        (const_int 1 [0x1])))
$21 = void
(gdb) p len
$22 = 2
(gdb) n
3209      for (i = 0; i < 4; i++)
(gdb)
3213          if (code != CONST_INT && code != REG && code != CLOBBER)
(gdb)
3214            x = simplify_rtx (x, op0_mode, i == 3, in_dest);
(gdb)
3216          if (GET_CODE (x) == code)
(gdb) p debug_rtx(x)

(if_then_else:SI (ne (reg/v:SI 84)
        (const_int 0 [0x0]))
    (lshiftrt:SI (reg:SI 3 r3)
        (const_int 1 [0x1]))
    (lshiftrt:SI (reg:SI 3 r3)
        (const_int 1 [0x1])))
$23 = void

This IF_THEN_ELSE doesn't look right to me. I'll continue debugging tomorrow,
it's already too late here :-).

Thanks for your assistance,
Franz.


More information about the Gcc mailing list