* [Bug target/53385] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
@ 2012-05-17 2:39 ` pinskia at gcc dot gnu.org
2012-05-17 2:45 ` dje at gcc dot gnu.org
` (15 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-05-17 2:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|tree-optimization |target
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-05-17 02:08:05 UTC ---
The target should have done a better job on its constraints.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug target/53385] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
2012-05-17 2:39 ` [Bug target/53385] " pinskia at gcc dot gnu.org
@ 2012-05-17 2:45 ` dje at gcc dot gnu.org
2012-05-17 12:07 ` amodra at gmail dot com
` (14 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: dje at gcc dot gnu.org @ 2012-05-17 2:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
David Edelsohn <dje at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-05-17
Ever Confirmed|0 |1
--- Comment #2 from David Edelsohn <dje at gcc dot gnu.org> 2012-05-17 02:39:19 UTC ---
Definitely caused by this revision.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug target/53385] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
2012-05-17 2:39 ` [Bug target/53385] " pinskia at gcc dot gnu.org
2012-05-17 2:45 ` dje at gcc dot gnu.org
@ 2012-05-17 12:07 ` amodra at gmail dot com
2012-05-17 12:40 ` amodra at gmail dot com
` (13 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: amodra at gmail dot com @ 2012-05-17 12:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
Alan Modra <amodra at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amodra at gmail dot com
--- Comment #3 from Alan Modra <amodra at gmail dot com> 2012-05-17 12:04:52 UTC ---
A data point. My stage1 gcc compiles the testcase in comment #1 OK, stage2 gcc
gives the "operand out of range" error.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug target/53385] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
` (2 preceding siblings ...)
2012-05-17 12:07 ` amodra at gmail dot com
@ 2012-05-17 12:40 ` amodra at gmail dot com
2012-05-17 12:57 ` [Bug tree-optimization/53385] " amodra at gmail dot com
` (12 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: amodra at gmail dot com @ 2012-05-17 12:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
--- Comment #4 from Alan Modra <amodra at gmail dot com> 2012-05-17 12:25:03 UTC ---
Here's the problem. Compiled with -m64 -O2, this
int f (long val)
{
int i;
if (val < 0)
i = -1;
else
for (i = 0; i < 64; i++)
if ((val <<= 1) < 0)
break;
return i;
}
is miscompiled to
sradi 3,3,63
ori 3,3,64
blr
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/53385] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
` (3 preceding siblings ...)
2012-05-17 12:40 ` amodra at gmail dot com
@ 2012-05-17 12:57 ` amodra at gmail dot com
2012-05-17 14:01 ` glisse at gcc dot gnu.org
` (11 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: amodra at gmail dot com @ 2012-05-17 12:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
Alan Modra <amodra at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|target |tree-optimization
--- Comment #5 from Alan Modra <amodra at gmail dot com> 2012-05-17 12:38:51 UTC ---
Changing back to tree-optimization. pinski, this time you don't know what
you're doing. ;-)
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/53385] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
` (4 preceding siblings ...)
2012-05-17 12:57 ` [Bug tree-optimization/53385] " amodra at gmail dot com
@ 2012-05-17 14:01 ` glisse at gcc dot gnu.org
2012-05-17 16:09 ` [Bug tree-optimization/53385] [4.8 Regression] " dje at gcc dot gnu.org
` (10 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: glisse at gcc dot gnu.org @ 2012-05-17 14:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
Marc Glisse <glisse at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |glisse at gcc dot gnu.org
--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> 2012-05-17 13:00:34 UTC ---
(In reply to comment #4)
> Here's the problem. Compiled with -m64 -O2, this
>
> int f (long val)
> {
> int i;
>
> if (val < 0)
> i = -1;
> else
> for (i = 0; i < 64; i++)
> if ((val <<= 1) < 0)
> break;
>
> return i;
> }
Is that just a -fwrapv issue?
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/53385] [4.8 Regression] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
` (5 preceding siblings ...)
2012-05-17 14:01 ` glisse at gcc dot gnu.org
@ 2012-05-17 16:09 ` dje at gcc dot gnu.org
2012-05-17 23:33 ` glisse at gcc dot gnu.org
` (9 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: dje at gcc dot gnu.org @ 2012-05-17 16:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
David Edelsohn <dje at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Target Milestone|--- |4.8.0
Summary|"Error: operand out of |[4.8 Regression] "Error:
|range" after changes for |operand out of range" after
|LSHIFT_EXPR in vrp.c |changes for LSHIFT_EXPR in
| |vrp.c
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/53385] [4.8 Regression] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
` (6 preceding siblings ...)
2012-05-17 16:09 ` [Bug tree-optimization/53385] [4.8 Regression] " dje at gcc dot gnu.org
@ 2012-05-17 23:33 ` glisse at gcc dot gnu.org
2012-05-18 7:04 ` wschmidt at gcc dot gnu.org
` (8 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: glisse at gcc dot gnu.org @ 2012-05-17 23:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
--- Comment #7 from Marc Glisse <glisse at gcc dot gnu.org> 2012-05-17 21:34:23 UTC ---
Created attachment 27429
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27429
patch
I believe you need something like this completely untested patch to avoid
undefined behavior without -fwrapv.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/53385] [4.8 Regression] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
` (7 preceding siblings ...)
2012-05-17 23:33 ` glisse at gcc dot gnu.org
@ 2012-05-18 7:04 ` wschmidt at gcc dot gnu.org
2012-05-18 9:23 ` jakub at gcc dot gnu.org
` (7 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2012-05-18 7:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
--- Comment #8 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-05-18 03:42:46 UTC ---
I suspect you're right. I'll have a look at it tomorrow.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/53385] [4.8 Regression] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
` (8 preceding siblings ...)
2012-05-18 7:04 ` wschmidt at gcc dot gnu.org
@ 2012-05-18 9:23 ` jakub at gcc dot gnu.org
2012-05-18 9:28 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-05-18 9:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-05-18 08:17:42 UTC ---
Isn't this just a fancy way of saying
i = val ? clz_hwi (val) - 1 : HOST_BITS_PER_WIDE_INT;
? Note that the predicate ensures that the whole operand isn't 0,
so one might as well use just i = clzi_hwi (val) - 1; and just adjust the
else if (GET_CODE (x) == CONST_DOUBLE && i == 32)
test to compare i == 31 instead (and tweak the body not to i-- if the low hwi
is negative and do another clz_hwi otherwise).
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/53385] [4.8 Regression] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
` (9 preceding siblings ...)
2012-05-18 9:23 ` jakub at gcc dot gnu.org
@ 2012-05-18 9:28 ` jakub at gcc dot gnu.org
2012-05-18 10:06 ` [Bug target/53385] " rguenth at gcc dot gnu.org
` (5 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-05-18 9:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-05-18 08:24:40 UTC ---
So I think you could do:
case 'W':
/* MB value for a PowerPC64 rldic operand. */
i = clz_hwi (GET_CODE (x) == CONST_INT
? INTVAL (x) : CONST_DOUBLE_HIGH (x));
#if HOST_BITS_PER_WIDE_INT == 32
if (GET_CODE (x) == CONST_INT && i)
i += 32; /* zero-extend high-part was all 0's */
else if (GET_CODE (x) == CONST_DOUBLE && i == 32)
i = clz_hwi (CONST_DOUBLE_LOW (x)) + 32;
#endif
fprintf (file, "%d", i);
return;
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug target/53385] [4.8 Regression] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
` (10 preceding siblings ...)
2012-05-18 9:28 ` jakub at gcc dot gnu.org
@ 2012-05-18 10:06 ` rguenth at gcc dot gnu.org
2012-05-18 14:27 ` wschmidt at gcc dot gnu.org
` (4 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-05-18 10:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|tree-optimization |target
--- Comment #11 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-05-18 09:45:31 UTC ---
Target issue.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug target/53385] [4.8 Regression] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
` (11 preceding siblings ...)
2012-05-18 10:06 ` [Bug target/53385] " rguenth at gcc dot gnu.org
@ 2012-05-18 14:27 ` wschmidt at gcc dot gnu.org
2012-05-18 17:45 ` wschmidt at gcc dot gnu.org
` (3 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2012-05-18 14:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
--- Comment #12 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-05-18 14:05:06 UTC ---
Created attachment 27433
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27433
Tentative patch
Tentative patch following Jakub's suggestion. This fixes bootstrap. Pending
approval.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug target/53385] [4.8 Regression] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
` (12 preceding siblings ...)
2012-05-18 14:27 ` wschmidt at gcc dot gnu.org
@ 2012-05-18 17:45 ` wschmidt at gcc dot gnu.org
2012-05-24 13:55 ` wschmidt at gcc dot gnu.org
` (2 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2012-05-18 17:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
William J. Schmidt <wschmidt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #13 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-05-18 16:06:16 UTC ---
Fixed by r187657.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug target/53385] [4.8 Regression] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
` (13 preceding siblings ...)
2012-05-18 17:45 ` wschmidt at gcc dot gnu.org
@ 2012-05-24 13:55 ` wschmidt at gcc dot gnu.org
2012-05-24 13:56 ` wschmidt at gcc dot gnu.org
2012-05-24 13:59 ` wschmidt at gcc dot gnu.org
16 siblings, 0 replies; 18+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2012-05-24 13:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
--- Comment #14 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-05-24 13:53:03 UTC ---
Author: wschmidt
Date: Thu May 24 13:52:56 2012
New Revision: 187834
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187834
Log:
2012-05-24 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
2012-05-18 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR target/53385
* config/rs6000/rs6000.c (print_operand): Revise code that unsafely
relied on signed overflow behavior.
Modified:
branches/gcc-4_6-branch/gcc/ChangeLog
branches/gcc-4_6-branch/gcc/config/rs6000/rs6000.c
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug target/53385] [4.8 Regression] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
` (14 preceding siblings ...)
2012-05-24 13:55 ` wschmidt at gcc dot gnu.org
@ 2012-05-24 13:56 ` wschmidt at gcc dot gnu.org
2012-05-24 13:59 ` wschmidt at gcc dot gnu.org
16 siblings, 0 replies; 18+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2012-05-24 13:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
--- Comment #14 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-05-24 13:53:03 UTC ---
Author: wschmidt
Date: Thu May 24 13:52:56 2012
New Revision: 187834
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187834
Log:
2012-05-24 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
2012-05-18 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR target/53385
* config/rs6000/rs6000.c (print_operand): Revise code that unsafely
relied on signed overflow behavior.
Modified:
branches/gcc-4_6-branch/gcc/ChangeLog
branches/gcc-4_6-branch/gcc/config/rs6000/rs6000.c
--- Comment #15 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-05-24 13:54:24 UTC ---
Author: wschmidt
Date: Thu May 24 13:54:16 2012
New Revision: 187835
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187835
Log:
2012-05-24 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
2012-05-18 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR target/53385
* config/rs6000/rs6000.c (print_operand): Revise code that unsafely
relied on signed overflow behavior.
Modified:
branches/gcc-4_7-branch/gcc/ChangeLog
branches/gcc-4_7-branch/gcc/config/rs6000/rs6000.c
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug target/53385] [4.8 Regression] "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c
2012-05-17 2:08 [Bug tree-optimization/53385] New: "Error: operand out of range" after changes for LSHIFT_EXPR in vrp.c wschmidt at gcc dot gnu.org
` (15 preceding siblings ...)
2012-05-24 13:56 ` wschmidt at gcc dot gnu.org
@ 2012-05-24 13:59 ` wschmidt at gcc dot gnu.org
16 siblings, 0 replies; 18+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2012-05-24 13:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53385
--- Comment #15 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-05-24 13:54:24 UTC ---
Author: wschmidt
Date: Thu May 24 13:54:16 2012
New Revision: 187835
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187835
Log:
2012-05-24 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
2012-05-18 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR target/53385
* config/rs6000/rs6000.c (print_operand): Revise code that unsafely
relied on signed overflow behavior.
Modified:
branches/gcc-4_7-branch/gcc/ChangeLog
branches/gcc-4_7-branch/gcc/config/rs6000/rs6000.c
^ permalink raw reply [flat|nested] 18+ messages in thread