]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[gcc]
authorwschmidt <wschmidt@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Apr 2016 15:42:19 +0000 (15:42 +0000)
committerwschmidt <wschmidt@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Apr 2016 15:42:19 +0000 (15:42 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234716 138bc75d-0d04-0410-961f-82ee72b054a4

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 83f3454a0eec1c5d5203378ca33da56aae82c125..b478b0f2832aee12b9caa4369b84030d94b459ef 100644 (file)
@@ -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
index 2de8ea55fd08be52f80f6d527b657f4110af206c..c9b020524d61bcd84c9c75c11959b138c607b239 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-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 (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 5206d202babd3be4f61fceeaf83cf23d0ed96a86..a4e044c611b26f97e4230d0da118a630018f474d 100644 (file)
@@ -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.
index 4626022b8b81c74e72d808d63d4c4ed4e7ea963a..735b7c67c31df0c8317544346396fb8b15315879 100644 (file)
@@ -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))
                    {