This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/27364] [4.1/4.2 Regression] VRP miscompiles some unsigned math



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]