[Bug tree-optimization/27364] [4.1/4.2 Regression] VRP miscompiles some unsigned math
law at redhat dot com
gcc-bugzilla@gcc.gnu.org
Mon May 1 16:36:00 GMT 2006
------- Comment #13 from law at redhat dot com 2006-05-01 16:36 -------
The overflow check for multiplication is totally bogus. The right way to check
for overflow of an integer multiplication is to use division.
ie, given
res = a * b;
Divide res by a, if the result is less than b, then the multiplication
overlowed.
[ Note, assumes a != 0. ] In fact, any result other than "b" is bad.
Anyway, once we muck up the overflow status of the multiplication we lose.
Jeff
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27364
More information about the Gcc-bugs
mailing list