]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/55890 (calling a builtin func through a cast triggers an...
authorJakub Jelinek <jakub@redhat.com>
Tue, 8 Jan 2013 08:38:50 +0000 (09:38 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 8 Jan 2013 08:38:50 +0000 (09:38 +0100)
PR middle-end/55890
* tree-ssa-ccp.c (evaluate_stmt): Use gimple_call_builtin_p.

* gcc.dg/torture/pr55890-3.c: New test.

From-SVN: r195008

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr55890-3.c [new file with mode: 0644]
gcc/tree-ssa-ccp.c

index 379de4d78d42ae6119739611832086030f235f29..7d9f569ebb27fba6847792805b4b2c2726fa8362 100644 (file)
@@ -1,5 +1,8 @@
 2013-01-08  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/55890
+       * tree-ssa-ccp.c (evaluate_stmt): Use gimple_call_builtin_p.
+
        PR tree-optimization/54120
        * tree-vrp.c (range_fits_type_p): Don't allow
        src_precision < precision from signed vr to unsigned_p
index c0159bcc6ad5ebc4790b2160e3bc031285825b7d..ffef63a345f53b1de533223bf5eb153d782f292e 100644 (file)
@@ -1,5 +1,8 @@
 2013-01-08  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/55890
+       * gcc.dg/torture/pr55890-3.c: New test.
+
        PR middle-end/55851
        * gcc.c-torture/compile/pr55851.c: New test.
 
diff --git a/gcc/testsuite/gcc.dg/torture/pr55890-3.c b/gcc/testsuite/gcc.dg/torture/pr55890-3.c
new file mode 100644 (file)
index 0000000..c7f77be
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+
+void *memmove ();
+
+void *
+bar ()
+{
+  return memmove ();
+}
index 4e565448d5b7c03be116ffaa043a5f889452d60a..29f169d3d4b8eb09ac527be3a3c457d3ef5982a2 100644 (file)
@@ -1,6 +1,6 @@
 /* Conditional constant propagation pass for the GNU compiler.
    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-   2010, 2011, 2012 Free Software Foundation, Inc.
+   2010, 2011, 2012, 2013 Free Software Foundation, Inc.
    Adapted from original RTL SSA-CCP by Daniel Berlin <dberlin@dberlin.org>
    Adapted to GIMPLE trees by Diego Novillo <dnovillo@redhat.com>
 
@@ -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: