aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>2016-04-04 15:42:19 +0000
committerWilliam Schmidt <wschmidt@gcc.gnu.org>2016-04-04 15:42:19 +0000
commitc974c96edf3bdb5d95ba997526e92ce834c0aaa1 (patch)
tree9d67f382c1c643eabb3c6bf93bf62b0ab5d236c6
parent7a85da896a9ceac338801d6ad0997ef7834660cb (diff)
downloadgcc-c974c96edf3bdb5d95ba997526e92ce834c0aaa1.zip
gcc-c974c96edf3bdb5d95ba997526e92ce834c0aaa1.tar.gz
gcc-c974c96edf3bdb5d95ba997526e92ce834c0aaa1.tar.bz2
re PR middle-end/70457 (ICE (segfault) in gimple_expand_builtin_pow on powerpc64le-linux-gnu)
[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 (pass_optimize_windening_mul::execute): 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: r234716
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr70457.c29
-rw-r--r--gcc/tree-inline.c2
-rw-r--r--gcc/tree-ssa-math-opts.c2
5 files changed, 47 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 83f3454..b478b0f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+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 (pass_optimize_windening_mul::execute):
+ Likewise.
+
2016-04-04 Richard Biener <rguenther@suse.de>
PR rtl-optimization/70484
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2de8ea5..c9b0205 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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-04-04 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/67538
diff --git a/gcc/testsuite/gcc.dg/torture/pr70457.c b/gcc/testsuite/gcc.dg/torture/pr70457.c
new file mode 100644
index 0000000..74daed4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr70457.c
@@ -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); }
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 5206d20..a4e044c 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4065,7 +4065,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.
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 4626022..735b7c6 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -3827,7 +3827,7 @@ pass_optimize_widening_mul::execute (function *fun)
{
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))
{