[Bug tree-optimization/14844] [tree-ssa] narrow types if wide result is not needed for unsigned types or when wrapping is true
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Nov 29 01:03:00 GMT 2005
------- Comment #10 from pinskia at gcc dot gnu dot org 2005-11-29 01:03 -------
(In reply to comment #5)
> Once fold is able to do (int)(a+b) into (int)a + (int)b, the combine pass
> (15459) should be able to fix this.
I should note this is only valid for unsigned types and when -fwrapv is
supplied as take a being INT_MAX and b being 1 (both have the same type which
is larger than int), with (int)(a) + (int)(b) we get an overflow which is
undefined but (int)(a+b) is defined as 0. See PR 25125 for an example of where
this goes wrong currently from the front-end/convert.c mess.
We could define a new trees for addition where overflow is defined as wrapping.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[tree-ssa] narrow types if |[tree-ssa] narrow types if
|wide result is not needed |wide result is not needed
| |for unsigned types or when
| |wrapping is true
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14844
More information about the Gcc-bugs
mailing list