]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/70457 (ICE (segfault) in gimple_expand_builtin_pow on powerpc64le...
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Mon, 4 Apr 2016 15:47:51 +0000 (15:47 +0000)
committerWilliam Schmidt <wschmidt@gcc.gnu.org>
Mon, 4 Apr 2016 15:47:51 +0000 (15:47 +0000)
[gcc]

2016-04-04  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
    Jakub Jelinek <jakub@redhat.com>

PR middle-end/70457
* tree-inline.c (estimate_num_insn): Use gimple_call_builtin_p
to ensure a call statement is compatible with a built-in's
prototype.
* tree-ssa-math-opts.c (execute_cse_sincos_1): Likewise.
(execute_cse_sincos): Likewise.
(execute_optimize_widening_mul): Likewise.

[gcc/testsuite]

2016-04-04  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
    Jakub Jelinek <jakub@redhat.com>

PR middle-end/70457
* gcc.dg/torture/pr70457.c: New.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r234718

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr70457.c [new file with mode: 0644]
gcc/tree-inline.c
gcc/tree-ssa-math-opts.c

index a0f3186a4f7c413d7c9428a2b9b8d11edd472543..3f0037211e87d939296f4d9c4a98c71be2fbdd66 100644 (file)
@@ -1,3 +1,14 @@
+2016-04-04  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+           Jakub Jelinek <jakub@redhat.com>
+
+       PR middle-end/70457
+       * tree-inline.c (estimate_num_insn): Use gimple_call_builtin_p
+       to ensure a call statement is compatible with a built-in's
+       prototype.
+       * tree-ssa-math-opts.c (execute_cse_sincos_1): Likewise.
+       (execute_cse_sincos): Likewise.
+       (execute_optimize_widening_mul): Likewise.
+
 2016-03-31  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * config/arm/sync.md (arm_atomic_loaddi2_ldrd): Fix output template
index 52bdf72a3df5b018d3f77fbe1caf1342011d0f19..24c86d45b4f99df1069ca1284fc4ff5ef8aee4c4 100644 (file)
@@ -1,3 +1,9 @@
+2016-04-04  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+           Jakub Jelinek <jakub@redhat.com>
+
+       PR middle-end/70457
+       * gcc.dg/torture/pr70457.c: New.
+
 2016-03-31  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * gcc.target/arm/atomic_loaddi_relaxed_cond.c: New test.
diff --git a/gcc/testsuite/gcc.dg/torture/pr70457.c b/gcc/testsuite/gcc.dg/torture/pr70457.c
new file mode 100644 (file)
index 0000000..74daed4
--- /dev/null
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+
+/* This formerly ICEd when trying to expand pow as a built-in with
+   the wrong number of arguments.  */
+
+extern double pow (double, double) __attribute__ ((__nothrow__ , __leaf__));
+
+typedef struct {
+  long long data;
+  int tag;
+} Object;
+
+extern Object Make_Flonum (double);
+extern Object P_Pow (Object, Object);
+
+Object General_Function (Object x, Object y, double (*fun)()) {
+  double d, ret;
+
+  d = 1.0;
+
+  if (y.tag >> 1)
+    ret = (*fun) (d);
+  else
+    ret = (*fun) (d, 0.0);
+
+  return Make_Flonum (ret);
+}
+
+Object P_Pow (Object x, Object y) { return General_Function (x, y, pow); }
index 5fd21fe0f30df4802c13b4899ca903f326b6fcef..ee3bbad3bc6daf9955ac5881546c422680e2b7d8 100644 (file)
@@ -3850,7 +3850,7 @@ estimate_num_insns (gimple stmt, eni_weights *weights)
              return 0;
            else if (is_inexpensive_builtin (decl))
              return weights->target_builtin_call_cost;
-           else if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
+           else if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
              {
                /* We canonicalize x * x to pow (x, 2.0) with -ffast-math, so
                   specialize the cheap expansion we do here.
index 0e8d54d34fee9ae5b6543411e451fd1151c4a6a6..0c40ade04c625f6260a73adff1e7f92f66142c3d 100644 (file)
@@ -746,7 +746,7 @@ execute_cse_sincos_1 (tree name)
       if (gimple_code (use_stmt) != GIMPLE_CALL
          || !gimple_call_lhs (use_stmt)
          || !(fndecl = gimple_call_fndecl (use_stmt))
-         || DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_NORMAL)
+         || !gimple_call_builtin_p (use_stmt, BUILT_IN_NORMAL))
        continue;
 
       switch (DECL_FUNCTION_CODE (fndecl))
@@ -1437,7 +1437,7 @@ execute_cse_sincos (void)
          if (is_gimple_call (stmt)
              && gimple_call_lhs (stmt)
              && (fndecl = gimple_call_fndecl (stmt))
-             && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+             && gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
            {
              tree arg, arg0, arg1, result;
              HOST_WIDE_INT n;
@@ -2860,7 +2860,7 @@ execute_optimize_widening_mul (void)
            {
              tree fndecl = gimple_call_fndecl (stmt);
              if (fndecl
-                 && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+                 && gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
                {
                  switch (DECL_FUNCTION_CODE (fndecl))
                    {