This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/60930] [4.8/4.9/4.10 Regression] Wrong folding of - ((unsigned long long) a * (unsigned long long) (unsigned int)-1)
- From: "wschmidt at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 23 Apr 2014 22:10:24 +0000
- Subject: [Bug tree-optimization/60930] [4.8/4.9/4.10 Regression] Wrong folding of - ((unsigned long long) a * (unsigned long long) (unsigned int)-1)
- Auto-submitted: auto-generated
- References: <bug-60930-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60930
--- Comment #6 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Perhaps I confused matters a little with the commentary. What's happening with
the bug is that the multiplication succeeds in the double-int but the product
is then truncated to the size of the stride type on the double_int_to_tree
call. If the sign changes during the truncation, then we have an effective
overflow when the target is that particular type. This seemed like a simple
way to detect the problem with minimal changes to the code. But I'm happy to
use whatever methods are preferred.