On 11/01/16 17:46, Richard Biener wrote:
On January 11, 2016 5:36:33 PM GMT+01:00, Bernd Schmidt <bschm...@redhat.com> 
wrote:
On 01/11/2016 05:33 PM, Matthew Wahab wrote:

The case I'm trying to fix has (short)abs((int)short_var). I'd
thought
that if
abs(short_var) was undefined because the result couldn't be
represented
then the type
conversion from int to short would also be undefined. In fact, it's
implementation
defined and S4.5 of the GCC manual says that the value is reduced
until
it can be
represented. So (short)abs((int)short_var) will produce a value when
abs(short_var) is undefined meaning this transformation isn't
correct.
I'll drop this patch.

Maybe we could have an optab and corresponding internal function for an

abs that's always defined.

I'd like to have ABSU_EXPR (or allow unsigned result on ABS_EXPR).


I'll see if I can do anything along those lines. This looks like something for stage 1 though.

Matthew

Reply via email to