Jakub Jelinek <ja...@redhat.com> wrote:

>Hi!
>
>evaluate_stmt can be crashed similarly to what you've fixed today.
>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Ok.

Thanks,
Richard.

>2013-01-07  Jakub Jelinek  <ja...@redhat.com>
>
>       PR middle-end/55890
>       * tree-ssa-ccp.c (evaluate_stmt): Use gimple_call_builtin_p.
>
>       * gcc.dg/torture/pr55890-3.c: New test.
>
>--- gcc/tree-ssa-ccp.c.jj      2012-11-19 14:41:17.000000000 +0100
>+++ gcc/tree-ssa-ccp.c 2013-01-07 18:53:39.952854381 +0100
>@@ -1546,7 +1546,6 @@ evaluate_stmt (gimple stmt)
>       && !is_constant)
>     {
>       enum gimple_code code = gimple_code (stmt);
>-      tree fndecl;
>       val.lattice_val = VARYING;
>       val.value = NULL_TREE;
>       val.mask = double_int_minus_one;
>@@ -1593,10 +1592,9 @@ evaluate_stmt (gimple stmt)
>             || POINTER_TYPE_P (TREE_TYPE (rhs1)))
>           val = bit_value_binop (code, TREE_TYPE (rhs1), rhs1, rhs2);
>       }
>-      else if (code == GIMPLE_CALL
>-             && (fndecl = gimple_call_fndecl (stmt))
>-             && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
>+      else if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
>       {
>+        tree fndecl = gimple_call_fndecl (stmt);
>         switch (DECL_FUNCTION_CODE (fndecl))
>           {
>           case BUILT_IN_MALLOC:
>--- gcc/testsuite/gcc.dg/torture/pr55890-3.c.jj        2013-01-07
>18:51:27.415614201 +0100
>+++ gcc/testsuite/gcc.dg/torture/pr55890-3.c   2013-01-07
>18:51:22.864640151 +0100
>@@ -0,0 +1,9 @@
>+/* { dg-do compile } */
>+
>+void *memmove ();
>+
>+void *
>+bar ()
>+{
>+  return memmove ();
>+}
>
>       Jakub


Reply via email to