From 819df7815634caf606a3d212ca4cba6a93acafd0 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 27 Mar 2017 12:52:13 +0000 Subject: [PATCH] re PR tree-optimization/80181 (ICE in set_lattice_value, at tree-ssa-ccp.c:505) 2017-03-27 Richard Biener PR tree-optimization/80181 * tree-ssa-ccp.c (likely_value): UNDEFINED ^ X is UNDEFINED. * gcc.dg/torture/pr80181.c: New testcase. From-SVN: r246500 --- gcc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr80181.c | 19 +++++++++++++++++++ gcc/tree-ssa-ccp.c | 4 +++- 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr80181.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6296cdd33de..600d26476b8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-03-27 Richard Biener + + PR tree-optimization/80181 + * tree-ssa-ccp.c (likely_value): UNDEFINED ^ X is UNDEFINED. + 2017-03-27 Claudiu Zissulescu * config/arc/predicates.md (move_double_src_operand): Replace the diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 184ccdb4712..bc302a8f757 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-27 Richard Biener + + PR tree-optimization/80181 + * gcc.dg/torture/pr80181.c: New testcase. + 2017-03-27 Claudiu Zissulescu * testsuite/gcc.target/arc/interrupt-4.c: New file. diff --git a/gcc/testsuite/gcc.dg/torture/pr80181.c b/gcc/testsuite/gcc.dg/torture/pr80181.c new file mode 100644 index 00000000000..896ca4fe0bd --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr80181.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ + +int +nr (void) +{ +} + +void +it (int dl) +{ + int vp = 0; + + for (;;) + { + dl = vp ^ nr (); + dl ^= vp; + vp = 1; + } +} diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index cd238242c01..023018c8d33 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -741,9 +741,11 @@ likely_value (gimple *stmt) case PLUS_EXPR: case MINUS_EXPR: case POINTER_PLUS_EXPR: + case BIT_XOR_EXPR: /* Not MIN_EXPR, MAX_EXPR. One VARYING operand may be selected. Not bitwise operators, one VARYING operand may specify the - result completely. Not logical operators for the same reason. + result completely. + Not logical operators for the same reason, apart from XOR. Not COMPLEX_EXPR as one VARYING operand makes the result partly not UNDEFINED. Not *DIV_EXPR, comparisons and shifts because the undefined operand may be promoted. */ -- 2.30.2