[PATCH 2/3] Simplify wrapped binops
Marc Glisse
marc.glisse@inria.fr
Sat Jul 15 09:58:00 GMT 2017
On Wed, 5 Jul 2017, Robin Dapp wrote:
>> While the initialization value doesn't matter (wi::add will overwrite it)
>> better initialize both to false ;) Ah, you mean because we want to
>> transform only if get_range_info returned VR_RANGE. Indeed somewhat
>> unintuitive (but still the best variant for now).
>
>> so I'm still missing a comment on why min_ovf && max_ovf is ok.
>> The simple-minded would have written [...]
>
> I suppose it's more a matter of considering too many things at the same
> time for me... I was still thinking of including more cases than
> necessary for the regression. Guess the attached version will do as
> well and should not contain any more surprises. If needed, I'll add
> additional cases some time.
What happens for (long)(X+10)+LONG_MAX where X has type int and is in
[-30, -20]? It looks like wi::add will overflow and you will generate
X+negative which overflows at runtime.
(It looks like you don't need to name @3, you could just use the type of
@0 instead)
--
Marc Glisse
More information about the Gcc-patches
mailing list