From a8e9a08a62fcf7afea9e570302247089379f36f4 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 11 Feb 2016 10:22:21 +0100 Subject: [PATCH] backport: re PR tree-optimization/69214 (ICE (segfault) at -Os on x86_64-linux-gnu in "fail_abnormal_edge_coalesce") Backported from mainline 2016-01-11 Jakub Jelinek PR tree-optimization/69214 * tree-vrp.c (simplify_cond_using_ranges): Don't propagate innerop into a comparison if SSA_NAME_OCCURS_IN_ABNORMAL_PHI. Formatting fix. * gcc.c-torture/compile/pr69214.c: New test. From-SVN: r233330 --- gcc/ChangeLog | 10 ++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/pr69214.c | 17 +++++++++++++++++ gcc/tree-vrp.c | 7 ++++--- 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr69214.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6c91448fb758..39b4aa922abf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2016-02-11 Jakub Jelinek + + Backported from mainline + 2016-01-11 Jakub Jelinek + + PR tree-optimization/69214 + * tree-vrp.c (simplify_cond_using_ranges): Don't propagate + innerop into a comparison if SSA_NAME_OCCURS_IN_ABNORMAL_PHI. + Formatting fix. + 2016-02-11 Oleg Endo Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2837786e3eee..c8a19a9fb6c3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2016-02-11 Jakub Jelinek Backported from mainline + 2016-01-11 Jakub Jelinek + + PR tree-optimization/69214 + * gcc.c-torture/compile/pr69214.c: New test. + 2016-01-08 Jakub Jelinek PR fortran/69128 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr69214.c b/gcc/testsuite/gcc.c-torture/compile/pr69214.c new file mode 100644 index 000000000000..61728f51a480 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr69214.c @@ -0,0 +1,17 @@ +/* PR tree-optimization/69214 */ + +extern void bar (void); +extern int __setjmp (char *); + +void +foo (char *p) +{ + int d = 0; + bar (); + if (__setjmp (p)) + return; + long a = d; + d = 8; + if (!a) + bar (); +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index fb3e05d85c20..5f3a6f8dbc31 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -9021,7 +9021,8 @@ simplify_cond_using_ranges (gimple stmt) innerop = gimple_assign_rhs1 (def_stmt); if (TREE_CODE (innerop) == SSA_NAME - && !POINTER_TYPE_P (TREE_TYPE (innerop))) + && !POINTER_TYPE_P (TREE_TYPE (innerop)) + && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (innerop)) { value_range_t *vr = get_value_range (innerop); @@ -9051,8 +9052,8 @@ simplify_cond_using_ranges (gimple stmt) else location = gimple_location (stmt); warning_at (location, OPT_Wstrict_overflow, - "assuming signed overflow does not occur when " - "simplifying conditional"); + "assuming signed overflow does not occur when " + "simplifying conditional"); } tree newconst = fold_convert (TREE_TYPE (innerop), op1); -- 2.47.2