This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/14844] [tree-ssa] narrow types if wide result is not needed for unsigned types or when wrapping is true
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Nov 2005 01:03:01 -0000
- Subject: [Bug tree-optimization/14844] [tree-ssa] narrow types if wide result is not needed for unsigned types or when wrapping is true
- References: <bug-14844-5009@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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