[Bug tree-optimization/31521] / conversion to >> is not done when the divisor can be zero
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Apr 10 07:39:00 GMT 2007
------- Comment #1 from pinskia at gcc dot gnu dot org 2007-04-10 08:39 -------
i_5 = ASSERT_EXPR <i_1, i_1 < x_10>;
D.1607_6 = i_5 / 4;
i_5: [0, 2147483646] EQUIVALENCES: { i_1 } (1 elements)
We don't do the shifting if i's range includes 0 which is wrong as 0>>n is
always 0 so the reduced testcase is:
int f(int x)
{
if (x<0) return 0;
return x/4;
}
We should be able to convert the / into a >> without any issue. Mine I have a
simple patch.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot
|dot org |org
Severity|normal |enhancement
Status|UNCONFIRMED |ASSIGNED
Component|pending |tree-optimization
Ever Confirmed|0 |1
GCC build triplet|x86_64-unknown-linux-gnu |
GCC host triplet|x86_64-unknown-linux-gnu |
GCC target triplet|x86_64-unknown-linux-gnu |
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2007-04-10 08:39:22
date| |
Summary|strength-reduce idiv given |/ conversion to >> is not
|assertion numerator is |done when the divisor can be
|positive |zero
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31521
More information about the Gcc-bugs
mailing list