------- Comment #1 from jakub at gcc dot gnu dot org  2009-03-13 12:23 -------
Created an attachment (id=17455)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17455&action=view)
gcc44-pr39454.patch

So far only very lightly tested fix (no bootstrap/regtest yet), actually either
the cse.c or rtlanal.c part alone fixes this problem.

In fold_rtx the problem is that we canonicalize const_arg1 (but without
modifying x), in order to optimize nested shifts.  As there aren't any, we fall
back to
new_rtx = simplify_binary_operation (code, mode, const_arg0 ? const_arg0 :
folded_arg0, const_arg1 ? const_arg1 : folded_arg1);
which returns NULL, as const_arg1 passed to it is already canonicalized.  As
new_rtx is NULL, we return x, but in x we haven't canonicalized the shift
count.

In nonzero_bits/num_sign_bit_copies for SHIFT_COUNT_TRUNCATED we either should
truncate the shift counts before using them, or (and if !SHIFT_COUNT_TRUNCATED
that's the only choice) not try to assume anything from out of range shifts.


-- 


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

Reply via email to