On Fri, Mar 13, 2009 at 4:07 PM, Paolo Bonzini <bonz...@gnu.org> wrote:
>
>> Hm.  In fold-const.c we try to make sure to produce the same result
>> as the target would for constant-folding shifts.  Thus, Paolo, I think
>> what fold-const.c does is what we should assume for
>> !SHIFT_COUNT_TRUNCATED.  No?
>
> Unfortunately it is not so simple.  fold-const.c is actually wrong, as
> witnessed by this program
>
>  static inline int f (int s) { return 2 << s; }
>  int main () { printf ("%d\n", f(33)); }
>
> which prints 4 at -O0 and 0 at -O2 on i686-pc-linux-gnu.

But this is because i?86 doesn't define SHIFT_COUNT_TRUNCATED, no?

Richard.

> This might mean either that it is easier than I thought (i.e. that all
> the subtleties of the targets could be ignored), but I want to play it
> safe and actually take the opportunity to fix the above problem (my
> current patch does fix it).
>
> Paolo
>

Reply via email to