This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/27364] [4.1/4.2 Regression] VRP miscompiles some unsigned math
- From: "law at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 May 2006 16:36:21 -0000
- Subject: [Bug tree-optimization/27364] [4.1/4.2 Regression] VRP miscompiles some unsigned math
- References: <bug-27364-682@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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