From: Jakub Jelinek Date: Tue, 27 Jun 2017 07:22:14 +0000 (+0200) Subject: re PR middle-end/81207 (tree check fail in simplify_builtin_call) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=00296d7f68fe3f6ce378fed88eab9999af3a2449;p=gcc.git re PR middle-end/81207 (tree check fail in simplify_builtin_call) PR middle-end/81207 * gimple-fold.c (replace_call_with_call_and_fold): Handle gimple_vuse copying separately from gimple_vdef copying. * gcc.c-torture/compile/pr81207.c: New test. From-SVN: r249677 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d2c4260faf2..e9dc0d6f2ba 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,10 +1,14 @@ +2017-06-27 Jakub Jelinek + + PR middle-end/81207 + * gimple-fold.c (replace_call_with_call_and_fold): Handle + gimple_vuse copying separately from gimple_vdef copying. + 2017-06-27 Prathamesh Kulkarni * value-prof.c (free_hist): Remove call to memset and the enclosing if condition. -gcc/ChangeLog: - 2017-06-26 Jerome Lambourg Olivier Hainque diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index a00c2c88713..8e315fe2e2e 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -607,9 +607,10 @@ replace_call_with_call_and_fold (gimple_stmt_iterator *gsi, gimple *repl) && TREE_CODE (gimple_vdef (stmt)) == SSA_NAME) { gimple_set_vdef (repl, gimple_vdef (stmt)); - gimple_set_vuse (repl, gimple_vuse (stmt)); SSA_NAME_DEF_STMT (gimple_vdef (repl)) = repl; } + if (gimple_vuse (stmt)) + gimple_set_vuse (repl, gimple_vuse (stmt)); gsi_replace (gsi, repl, false); fold_stmt (gsi); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 38e5c7a9434..0217b7f0bee 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-06-27 Jakub Jelinek + + PR middle-end/81207 + * gcc.c-torture/compile/pr81207.c: New test. + 2017-06-27 Marek Polacek PR bootstrap/81216 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr81207.c b/gcc/testsuite/gcc.c-torture/compile/pr81207.c new file mode 100644 index 00000000000..f0faa8c0a22 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr81207.c @@ -0,0 +1,13 @@ +/* PR middle-end/81207 */ + +static const char *b[2] = { "'", "" }; + +int +foo (const char *d) +{ + int e; + for (e = 0; b[e]; e++) + if (__builtin_strstr (d, b[e])) + return 1; + return 0; +}