Commit 7c05f5c4 by Richard Biener Committed by Richard Biener

re PR tree-optimization/77544 (segfault at -O0 - infinite loop in simplification)

2016-09-15  Richard Biener  <rguenther@suse.de>

	PR middle-end/77544
	* fold-const.c (split_tree): Do not split constant ~X.

	* c-c++-common/torture/pr77544.c: New testcase.

From-SVN: r240164
parent 63c879fc
2016-09-15 Richard Biener <rguenther@suse.de>
PR middle-end/77544
* fold-const.c (split_tree): Do not split constant ~X.
2016-09-15 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/77425
......
......@@ -837,15 +837,16 @@ split_tree (location_t loc, tree in, tree type, enum tree_code code,
var = negate_expr (var);
}
}
else if (TREE_CONSTANT (in))
*conp = in;
else if (TREE_CODE (in) == BIT_NOT_EXPR
&& code == PLUS_EXPR)
{
/* -X - 1 is folded to ~X, undo that here. */
/* -X - 1 is folded to ~X, undo that here. Do _not_ do this
when IN is constant. */
*minus_litp = build_one_cst (TREE_TYPE (in));
var = negate_expr (TREE_OPERAND (in, 0));
}
else if (TREE_CONSTANT (in))
*conp = in;
else
var = in;
......
2016-09-15 Richard Biener <rguenther@suse.de>
PR middle-end/77544
* c-c++-common/torture/pr77544.c: New testcase.
2016-09-15 Jakub Jelinek <jakub@redhat.com>
PR middle-end/77475
......
/* { dg-do compile } */
struct {
long a : 17;
} b;
int c, d;
void e() { b.a = d + c + ~(long)(302806U >> 0); }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment