* [Bug tree-optimization/61045] Wrong constant folding
2014-05-03 15:41 [Bug tree-optimization/61045] New: Wrong constant folding ishiura-compiler at ml dot kwansei.ac.jp
@ 2014-05-03 15:57 ` mpolacek at gcc dot gnu.org
2014-05-03 15:59 ` [Bug middle-end/61045] [4.7/4.8/4.9/4.10 Regression] " mpolacek at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-05-03 15:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61045
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-05-03
CC| |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed. Fold introduces signed overflow:
long int a = 0;
long int b = 9223372036854775807;
int t = b + 1 < a;
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/61045] [4.7/4.8/4.9/4.10 Regression] Wrong constant folding
2014-05-03 15:41 [Bug tree-optimization/61045] New: Wrong constant folding ishiura-compiler at ml dot kwansei.ac.jp
2014-05-03 15:57 ` [Bug tree-optimization/61045] " mpolacek at gcc dot gnu.org
@ 2014-05-03 15:59 ` mpolacek at gcc dot gnu.org
2014-05-03 16:00 ` mikpelinux at gmail dot com
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-05-03 15:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61045
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|tree-optimization |middle-end
Target Milestone|--- |4.7.4
Summary|Wrong constant folding |[4.7/4.8/4.9/4.10
| |Regression] Wrong constant
| |folding
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/61045] [4.7/4.8/4.9/4.10 Regression] Wrong constant folding
2014-05-03 15:41 [Bug tree-optimization/61045] New: Wrong constant folding ishiura-compiler at ml dot kwansei.ac.jp
2014-05-03 15:57 ` [Bug tree-optimization/61045] " mpolacek at gcc dot gnu.org
2014-05-03 15:59 ` [Bug middle-end/61045] [4.7/4.8/4.9/4.10 Regression] " mpolacek at gcc dot gnu.org
@ 2014-05-03 16:00 ` mikpelinux at gmail dot com
2014-05-03 17:02 ` mpolacek at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mikpelinux at gmail dot com @ 2014-05-03 16:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61045
Mikael Pettersson <mikpelinux at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikpelinux at gmail dot com
--- Comment #2 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Fails also with gcc 4.3.6, works with gcc 4.2.4 and 4.1.2.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/61045] [4.7/4.8/4.9/4.10 Regression] Wrong constant folding
2014-05-03 15:41 [Bug tree-optimization/61045] New: Wrong constant folding ishiura-compiler at ml dot kwansei.ac.jp
` (2 preceding siblings ...)
2014-05-03 16:00 ` mikpelinux at gmail dot com
@ 2014-05-03 17:02 ` mpolacek at gcc dot gnu.org
2014-05-03 19:31 ` mikpelinux at gmail dot com
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-05-03 17:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61045
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I believe this started with addition of this folding in r117931, but didn't
verify it.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/61045] [4.7/4.8/4.9/4.10 Regression] Wrong constant folding
2014-05-03 15:41 [Bug tree-optimization/61045] New: Wrong constant folding ishiura-compiler at ml dot kwansei.ac.jp
` (3 preceding siblings ...)
2014-05-03 17:02 ` mpolacek at gcc dot gnu.org
@ 2014-05-03 19:31 ` mikpelinux at gmail dot com
2014-05-05 9:11 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mikpelinux at gmail dot com @ 2014-05-03 19:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61045
--- Comment #4 from Mikael Pettersson <mikpelinux at gmail dot com> ---
According to my bisection it did start with r117931.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/61045] [4.7/4.8/4.9/4.10 Regression] Wrong constant folding
2014-05-03 15:41 [Bug tree-optimization/61045] New: Wrong constant folding ishiura-compiler at ml dot kwansei.ac.jp
` (4 preceding siblings ...)
2014-05-03 19:31 ` mikpelinux at gmail dot com
@ 2014-05-05 9:11 ` rguenth at gcc dot gnu.org
2014-05-28 11:10 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-05 9:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61045
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Mine then.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/61045] [4.7/4.8/4.9/4.10 Regression] Wrong constant folding
2014-05-03 15:41 [Bug tree-optimization/61045] New: Wrong constant folding ishiura-compiler at ml dot kwansei.ac.jp
` (5 preceding siblings ...)
2014-05-05 9:11 ` rguenth at gcc dot gnu.org
@ 2014-05-28 11:10 ` rguenth at gcc dot gnu.org
2014-05-28 12:44 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-28 11:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61045
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
/* Put the constant on the side where it doesn't overflow and is
of lower absolute value than before. */
cst = int_const_binop (TREE_CODE (arg0) == TREE_CODE (arg1)
? MINUS_EXPR : PLUS_EXPR,
const2, const1);
if (!TREE_OVERFLOW (cst)
&& tree_int_cst_compare (const2, cst) == tree_int_cst_sgn (const2))
const2 is -1 here and cst is 1. So that means just checking for
"lower absolute value" is wrong. A sign-change is obviously not ok either.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/61045] [4.7/4.8/4.9/4.10 Regression] Wrong constant folding
2014-05-03 15:41 [Bug tree-optimization/61045] New: Wrong constant folding ishiura-compiler at ml dot kwansei.ac.jp
` (6 preceding siblings ...)
2014-05-28 11:10 ` rguenth at gcc dot gnu.org
@ 2014-05-28 12:44 ` rguenth at gcc dot gnu.org
2014-05-28 12:47 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-28 12:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61045
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Wed May 28 12:44:11 2014
New Revision: 211018
URL: http://gcc.gnu.org/viewcvs?rev=211018&root=gcc&view=rev
Log:
2014-05-28 Richard Biener <rguenther@suse.de>
PR middle-end/61045
* fold-const.c (fold_comparison): When folding
X +- C1 CMP Y +- C2 to X CMP Y +- C2 +- C1 also ensure
the sign of the remaining constant operand stays the same.
* gcc.dg/pr61045.c: New testcase.
Added:
trunk/gcc/testsuite/gcc.dg/pr61045.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/fold-const.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/61045] [4.7/4.8/4.9/4.10 Regression] Wrong constant folding
2014-05-03 15:41 [Bug tree-optimization/61045] New: Wrong constant folding ishiura-compiler at ml dot kwansei.ac.jp
` (7 preceding siblings ...)
2014-05-28 12:44 ` rguenth at gcc dot gnu.org
@ 2014-05-28 12:47 ` rguenth at gcc dot gnu.org
2014-06-12 13:44 ` [Bug middle-end/61045] [4.7/4.8 " rguenth at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-28 12:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61045
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Wed May 28 12:46:39 2014
New Revision: 211019
URL: http://gcc.gnu.org/viewcvs?rev=211019&root=gcc&view=rev
Log:
2014-05-28 Richard Biener <rguenther@suse.de>
Backport from mainline
2014-05-28 Richard Biener <rguenther@suse.de>
PR middle-end/61045
* fold-const.c (fold_comparison): When folding
X +- C1 CMP Y +- C2 to X CMP Y +- C2 +- C1 also ensure
the sign of the remaining constant operand stays the same.
* gcc.dg/pr61045.c: New testcase.
2014-05-05 Richard Biener <rguenther@suse.de>
PR middle-end/61010
* fold-const.c (fold_binary_loc): Consistently avoid
canonicalizing X & CST away from a CST that is the mask
of a mode.
* gcc.dg/torture/pr61010.c: New testcase.
2014-04-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/60979
* graphite-scop-detection.c (scopdet_basic_block_info): Reject
SCOPs that end in a block with a successor with abnormal
predecessors.
* gcc.dg/graphite/pr60979.c: New testcase.
Added:
branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/graphite/pr60979.c
branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/pr61045.c
branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/torture/pr61010.c
Modified:
branches/gcc-4_9-branch/gcc/ChangeLog
branches/gcc-4_9-branch/gcc/fold-const.c
branches/gcc-4_9-branch/gcc/graphite-scop-detection.c
branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/61045] [4.7/4.8 Regression] Wrong constant folding
2014-05-03 15:41 [Bug tree-optimization/61045] New: Wrong constant folding ishiura-compiler at ml dot kwansei.ac.jp
` (8 preceding siblings ...)
2014-05-28 12:47 ` rguenth at gcc dot gnu.org
@ 2014-06-12 13:44 ` rguenth at gcc dot gnu.org
2014-09-09 13:18 ` [Bug middle-end/61045] [4.8 " rguenth at gcc dot gnu.org
2014-09-09 13:19 ` rguenth at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-12 13:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61045
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.7.4 |4.8.4
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
The 4.7 branch is being closed, moving target milestone to 4.8.4.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/61045] [4.8 Regression] Wrong constant folding
2014-05-03 15:41 [Bug tree-optimization/61045] New: Wrong constant folding ishiura-compiler at ml dot kwansei.ac.jp
` (9 preceding siblings ...)
2014-06-12 13:44 ` [Bug middle-end/61045] [4.7/4.8 " rguenth at gcc dot gnu.org
@ 2014-09-09 13:18 ` rguenth at gcc dot gnu.org
2014-09-09 13:19 ` rguenth at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-09-09 13:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61045
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Tue Sep 9 13:17:51 2014
New Revision: 215073
URL: https://gcc.gnu.org/viewcvs?rev=215073&root=gcc&view=rev
Log:
2014-09-09 Richard Biener <rguenther@suse.de>
Backport from mainline
2014-05-05 Richard Biener <rguenther@suse.de>
PR middle-end/61010
* fold-const.c (fold_binary_loc): Consistently avoid
canonicalizing X & CST away from a CST that is the mask
of a mode.
* gcc.dg/torture/pr61010.c: New testcase.
2014-05-28 Richard Biener <rguenther@suse.de>
PR middle-end/61045
* fold-const.c (fold_comparison): When folding
X +- C1 CMP Y +- C2 to X CMP Y +- C2 +- C1 also ensure
the sign of the remaining constant operand stays the same.
* gcc.dg/pr61045.c: New testcase.
2014-08-11 Richard Biener <rguenther@suse.de>
PR tree-optimization/62075
* tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Properly
handle uses in patterns.
* gcc.dg/vect/pr62075.c: New testcase.
Added:
branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/pr61045.c
branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr61010.c
branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/vect/pr62075.c
Modified:
branches/gcc-4_8-branch/gcc/ChangeLog
branches/gcc-4_8-branch/gcc/fold-const.c
branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
branches/gcc-4_8-branch/gcc/tree-vect-slp.c
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/61045] [4.8 Regression] Wrong constant folding
2014-05-03 15:41 [Bug tree-optimization/61045] New: Wrong constant folding ishiura-compiler at ml dot kwansei.ac.jp
` (10 preceding siblings ...)
2014-09-09 13:18 ` [Bug middle-end/61045] [4.8 " rguenth at gcc dot gnu.org
@ 2014-09-09 13:19 ` rguenth at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-09-09 13:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61045
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Known to work|4.10.0 |4.8.4, 5.0
Resolution|--- |FIXED
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 13+ messages in thread