diff options
author | Richard Biener <rguenther@suse.de> | 2016-02-18 08:43:58 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-02-18 08:43:58 +0000 |
commit | 23f278396845947f49e597363aaa236ebb4f4e0e (patch) | |
tree | 9c824672154edd8b17d6a93909e4680f28c04978 /gcc | |
parent | 43414a5dd3a9b9b02bc675e1c33140021c3848aa (diff) | |
download | gcc-23f278396845947f49e597363aaa236ebb4f4e0e.zip gcc-23f278396845947f49e597363aaa236ebb4f4e0e.tar.gz gcc-23f278396845947f49e597363aaa236ebb4f4e0e.tar.bz2 |
re PR middle-end/69854 (ICE: tree check: expected class 'constant', have 'binary' (plus_expr) in generic_simplify_65, at generic-match.c:3110)
2016-02-18 Richard Biener <rguenther@suse.de>
PR middle-end/69854
* match.pd: Don't use fold_binary or fold_unary for folding
constants.
* gcc.dg/torture/pr69854.c: New testcase.
From-SVN: r233516
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/match.pd | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr69854.c | 8 |
4 files changed, 24 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6ca3c04..f2ce850 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-02-18 Richard Biener <rguenther@suse.de> + + PR middle-end/69854 + * match.pd: Don't use fold_binary or fold_unary for folding + constants. + 2016-02-17 Jakub Jelinek <jakub@redhat.com> PR c++/69850 diff --git a/gcc/match.pd b/gcc/match.pd index a0c6a3a..5903782 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1063,7 +1063,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) /* If the constant operation overflows we cannot do the transform as we would introduce undefined overflow, for example with (a - 1) + INT_MIN. */ - (with { tree cst = fold_binary (outer_op == inner_op + (with { tree cst = const_binop (outer_op == inner_op ? PLUS_EXPR : MINUS_EXPR, type, @1, @2); } (if (cst && !TREE_OVERFLOW (cst)) (inner_op @0 { cst; } )))))) @@ -1072,7 +1072,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (for outer_op (plus minus) (simplify (outer_op (minus CONSTANT_CLASS_P@1 @0) CONSTANT_CLASS_P@2) - (with { tree cst = fold_binary (outer_op, type, @1, @2); } + (with { tree cst = const_binop (outer_op, type, @1, @2); } (if (cst && !TREE_OVERFLOW (cst)) (minus { cst; } @0))))) @@ -1270,7 +1270,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) RROTATE_EXPR by a new constant. */ (simplify (lrotate @0 INTEGER_CST@1) - (rrotate @0 { fold_binary (MINUS_EXPR, TREE_TYPE (@1), + (rrotate @0 { const_binop (MINUS_EXPR, TREE_TYPE (@1), build_int_cst (TREE_TYPE (@1), element_precision (type)), @1); })) @@ -1596,7 +1596,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (simplify (plus @0 REAL_CST@1) (if (REAL_VALUE_NEGATIVE (TREE_REAL_CST (@1))) - (with { tree tem = fold_unary (NEGATE_EXPR, type, @1); } + (with { tree tem = const_unop (NEGATE_EXPR, type, @1); } (if (!TREE_OVERFLOW (tem) || !flag_trapping_math) (minus @0 { tem; }))))) @@ -2149,7 +2149,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (if (FLOAT_TYPE_P (TREE_TYPE (@0)) || (ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0)) && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (@0)))) - (with { tree tem = fold_unary (NEGATE_EXPR, TREE_TYPE (@0), @1); } + (with { tree tem = const_unop (NEGATE_EXPR, TREE_TYPE (@0), @1); } (if (tem && !TREE_OVERFLOW (tem)) (scmp @0 { tem; })))))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 13e3388..74a99e6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-02-18 Richard Biener <rguenther@suse.de> + + PR middle-end/69854 + * gcc.dg/torture/pr69854.c: New testcase. + 2016-02-17 Jakub Jelinek <jakub@redhat.com> PR c++/69850 diff --git a/gcc/testsuite/gcc.dg/torture/pr69854.c b/gcc/testsuite/gcc.dg/torture/pr69854.c new file mode 100644 index 0000000..5655847 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr69854.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-frounding-math -ffast-math" } */ + +double fn1() +{ + double w, s = fn1() - 6.12323399573676603587e17; + return 1.57079632679489655800e00 - (s + w); +} |