]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/46663 (ICE: SIGSEGV in vect_recog_pow_pattern (gimple.h:2055...
authorRichard Guenther <rguenther@suse.de>
Sun, 5 Dec 2010 11:31:09 +0000 (11:31 +0000)
committerIra Rosen <irar@gcc.gnu.org>
Sun, 5 Dec 2010 11:31:09 +0000 (11:31 +0000)
PR tree-optimization/46663
* tree-vect-patterns.c (vect_recog_pow_pattern): Check that
FUNCTION_DECL exists and that it's a builtin.

Co-Authored-By: Ira Rosen <irar@il.ibm.com>
From-SVN: r167472

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr46663.c [new file with mode: 0644]
gcc/tree-vect-patterns.c

index 85c1deebd6e8a6f974cec46482ae3422e225bcff..3163042f937370b1a9a3fa458ba0e1e992a13e69 100644 (file)
@@ -1,3 +1,10 @@
+2010-12-05  Richard Guenther  <rguenther@suse.de>
+           Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/46663
+       * tree-vect-patterns.c (vect_recog_pow_pattern): Check that
+       FUNCTION_DECL exists and that it's a builtin.
+
 2010-11-29  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR rtl-optimization/46337
index 70000a24f844ca675642ea2c168a0e79cf945f9e..fec8325b1bf30d4cc4c2c235be802f1b7f9fd322 100644 (file)
@@ -1,3 +1,9 @@
+2010-12-05  Richard Guenther  <rguenther@suse.de>
+           Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/46663
+       * gcc.dg/vect/pr46663.c: New test.
+
 2010-11-28  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/aliasing2.adb (dg-final): Robustify pattern matching.
diff --git a/gcc/testsuite/gcc.dg/vect/pr46663.c b/gcc/testsuite/gcc.dg/vect/pr46663.c
new file mode 100644 (file)
index 0000000..42a1ffb
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-vectorize -fdump-tree-vect-details -fexceptions" } */
+
+typedef __attribute__ ((const)) int (*bart) (void);
+
+int foo (bart bar, int m)
+{
+  int i, j = 0;
+  for (i = 0; i < m; i++)
+    j += bar();
+  return j;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
index 8486775ab775a0ba475c4e4cd6732b33f466248e..1515318bbc1f4badec54f6fe60599d7e5688d082 100644 (file)
@@ -475,6 +475,9 @@ vect_recog_pow_pattern (gimple last_stmt, tree *type_in, tree *type_out)
   type = gimple_expr_type (last_stmt);
 
   fn = gimple_call_fndecl (last_stmt);
+  if (fn == NULL_TREE || DECL_BUILT_IN_CLASS (fn) != BUILT_IN_NORMAL)
+    return NULL;
+
   switch (DECL_FUNCTION_CODE (fn))
     {
     case BUILT_IN_POWIF: