This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/39870] VRP can't see through cast to unsigned
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Apr 2009 16:41:01 -0000
- Subject: [Bug tree-optimization/39870] VRP can't see through cast to unsigned
- References: <bug-39870-511@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #13 from rguenth at gcc dot gnu dot org 2009-04-24 16:41 -------
<bb 4>:
x_11 = ASSERT_EXPR <x_13, x_13 <= 10>;
x.0_3 = (unsigned int) x_11;
D.1241_4 = x.0_3 + 0x0ffffffff;
if (D.1241_4 > 9)
x.0_3: [1, 10]
D.1241_4: [0, +INF]
so it's only only the usual case of not handling overflow properly during
evaluation. [1, 10] + -1U is [0(overflow), 9(overflow)] for VRP and so
it falls back to VARYING. To fix this we need to know the direction
of overflow. See also PR30318.
The patch I was refering to made VRP able to derive a range from
the D.1241_4 > 9 test.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39870