[Bug tree-optimization/66828] [5/6 Regression] gcc/tree-ssa-math-opts.c:2182:38: runtime error: left shift of 72057594037927936 by 8 places cannot be represented in type 'long int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66828 Markus Trippelsdorf trippels at gcc dot gnu.org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #13 from Markus Trippelsdorf trippels at gcc dot gnu.org --- Fixed, thanks.
[Bug tree-optimization/66828] [5/6 Regression] gcc/tree-ssa-math-opts.c:2182:38: runtime error: left shift of 72057594037927936 by 8 places cannot be represented in type 'long int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66828 --- Comment #12 from Thomas Preud'homme thopre01 at gcc dot gnu.org --- Author: thopre01 Date: Tue Aug 11 07:58:07 2015 New Revision: 226775 URL: https://gcc.gnu.org/viewcvs?rev=226775root=gccview=rev Log: 2015-08-11 Thomas Preud'homme thomas.preudho...@arm.com Backport from mainline 2015-07-28 Thomas Preud'homme thomas.preudho...@arm.com gcc/ PR tree-optimization/66828 * tree-ssa-math-opts.c (perform_symbolic_merge): Change type of inc from int64_t to uint64_t. Modified: branches/gcc-5-branch/gcc/ChangeLog branches/gcc-5-branch/gcc/tree-ssa-math-opts.c
[Bug tree-optimization/66828] [5/6 Regression] gcc/tree-ssa-math-opts.c:2182:38: runtime error: left shift of 72057594037927936 by 8 places cannot be represented in type 'long int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66828 --- Comment #11 from Thomas Preud'homme thopre01 at gcc dot gnu.org --- Sure. Starting bootstrap and testing.
[Bug tree-optimization/66828] [5/6 Regression] gcc/tree-ssa-math-opts.c:2182:38: runtime error: left shift of 72057594037927936 by 8 places cannot be represented in type 'long int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66828 --- Comment #10 from Markus Trippelsdorf trippels at gcc dot gnu.org --- Thomas, could you backport your fix to the gcc-5 branch, so that we can close this issue?
[Bug tree-optimization/66828] [5/6 Regression] gcc/tree-ssa-math-opts.c:2182:38: runtime error: left shift of 72057594037927936 by 8 places cannot be represented in type 'long int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66828 --- Comment #9 from Thomas Preud'homme thopre01 at gcc dot gnu.org --- Author: thopre01 Date: Tue Jul 28 06:54:50 2015 New Revision: 226298 URL: https://gcc.gnu.org/viewcvs?rev=226298root=gccview=rev Log: 2015-07-28 Thomas Preud'homme thomas.preudho...@arm.com PR tree-optimization/66828 * tree-ssa-math-opts.c (perform_symbolic_merge): Change type of inc from int64_t to uint64_t. Modified: trunk/gcc/ChangeLog trunk/gcc/tree-ssa-math-opts.c
[Bug tree-optimization/66828] [5/6 Regression] gcc/tree-ssa-math-opts.c:2182:38: runtime error: left shift of 72057594037927936 by 8 places cannot be represented in type 'long int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66828 --- Comment #8 from Markus Trippelsdorf trippels at gcc dot gnu.org --- (In reply to Thomas Preud'homme from comment #7) (In reply to Thomas Preud'homme from comment #6) Created attachment 36078 [details] Use unsigned type for inc to have defined left shift Sorry for the delay, I got busy on some other bugs. Would you mind giving the patch attached to the PR a go? I tried reproducing the issue but couldn't. I did ran the regression testsuite though and it's all good. Well, the fix is obvious. So I would just commit it.
[Bug tree-optimization/66828] [5/6 Regression] gcc/tree-ssa-math-opts.c:2182:38: runtime error: left shift of 72057594037927936 by 8 places cannot be represented in type 'long int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66828 --- Comment #6 from Thomas Preud'homme thopre01 at gcc dot gnu.org --- Created attachment 36078 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=36078action=edit Use unsigned type for inc to have defined left shift
[Bug tree-optimization/66828] [5/6 Regression] gcc/tree-ssa-math-opts.c:2182:38: runtime error: left shift of 72057594037927936 by 8 places cannot be represented in type 'long int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66828 --- Comment #7 from Thomas Preud'homme thopre01 at gcc dot gnu.org --- (In reply to Thomas Preud'homme from comment #6) Created attachment 36078 [details] Use unsigned type for inc to have defined left shift Hi Markus, Sorry for the delay, I got busy on some other bugs. Would you mind giving the patch attached to the PR a go? I tried reproducing the issue but couldn't. I did ran the regression testsuite though and it's all good. Best regards.
[Bug tree-optimization/66828] [5/6 Regression] gcc/tree-ssa-math-opts.c:2182:38: runtime error: left shift of 72057594037927936 by 8 places cannot be represented in type 'long int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66828 Richard Biener rguenth at gcc dot gnu.org changed: What|Removed |Added Target Milestone|5.2 |5.3 --- Comment #5 from Richard Biener rguenth at gcc dot gnu.org --- GCC 5.2 is being released, adjusting target milestone to 5.3.
[Bug tree-optimization/66828] [5/6 Regression] gcc/tree-ssa-math-opts.c:2182:38: runtime error: left shift of 72057594037927936 by 8 places cannot be represented in type 'long int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66828 --- Comment #4 from Thomas Preud'homme thopre01 at gcc dot gnu.org --- Indeed, I always forget. But as it goes, the excerpt you quote from C++ standard is exactly the same as in C99 so that doesn't invalidate the remaining of my analysis. The testing for the new patch is almost finished running so I'll soon post something up for review.
[Bug tree-optimization/66828] [5/6 Regression] gcc/tree-ssa-math-opts.c:2182:38: runtime error: left shift of 72057594037927936 by 8 places cannot be represented in type 'long int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66828 --- Comment #3 from Markus Trippelsdorf trippels at gcc dot gnu.org --- Well, gcc is a C++ project so the C99 standard doesn't apply. The C++ standard says: 5.8.2: The value of E1 E2 is E1 left-shifted E2 bit positions; vacated bits are zero-filled. If E1 has an unsigned type, the value of the result is E1 × 2E2 , reduced modulo one more than the maximum value representable in the result type. Otherwise, if E1 has a signed type and non-negative value, and E1 × 2E2 is representable in the corresponding unsigned type of the result type, then that value, converted to the result type, is the resulting value; otherwise, the behavior is undefined.
[Bug tree-optimization/66828] [5/6 Regression] gcc/tree-ssa-math-opts.c:2182:38: runtime error: left shift of 72057594037927936 by 8 places cannot be represented in type 'long int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66828 --- Comment #2 from Thomas Preud'homme thopre01 at gcc dot gnu.org --- The C standard says nothing about the cumulative effect of several shift so I'm guessing that the real issue is probably that the type is signed. Quoting C99 section 6.5.8 paragraph 4: If E1 has a signed type and nonnegative value, and E1 × 2E2 is representable in the result type, then that is the resulting value; otherwise, the behavior is undefined. Which is the case for the last iteration.
[Bug tree-optimization/66828] [5/6 Regression] gcc/tree-ssa-math-opts.c:2182:38: runtime error: left shift of 72057594037927936 by 8 places cannot be represented in type 'long int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66828 Thomas Preud'homme thopre01 at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Last reconfirmed||2015-07-13 Ever confirmed|0 |1 --- Comment #1 from Thomas Preud'homme thopre01 at gcc dot gnu.org --- I'm having trouble to reproduce the bug. I do encounter some ubsan errors but in other files (most notably in hwint.h). This might hide the errors in tree-ssa-math-opts.c Anyway, according to the line number the issue seems to come from the following line: for (i = 0; i size; i++, inc = BITS_PER_MARKER) size is guaranteed to be less or equal to 64 / BITS_PER_MARKER as per checks in find_bswap_or_nop_1 (CASE_CONVERT) and in init_symbolic_number. However, this means after the last execution of the body, inc is shift by more than 63 bits in total. I'm now testing a patch via bootstrap + regression testsuite.
[Bug tree-optimization/66828] [5/6 Regression] gcc/tree-ssa-math-opts.c:2182:38: runtime error: left shift of 72057594037927936 by 8 places cannot be represented in type 'long int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66828 Richard Biener rguenth at gcc dot gnu.org changed: What|Removed |Added Target Milestone|--- |5.2