]> 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>
Thu, 2 Dec 2010 11:47:12 +0000 (11:47 +0000)
committerIra Rosen <irar@gcc.gnu.org>
Thu, 2 Dec 2010 11:47:12 +0000 (11:47 +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: r167366

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

index f4302dc8b7501e0ccf3d9c916796713c51e69d4a..7d7e19180dc3216ecea138419cd2d4e10e115ec8 100644 (file)
@@ -1,3 +1,10 @@
+2010-12-02  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-12-02  Jie Zhang  <jie@codesourcery.com>
 
        PR middle-end/46674
index d70e0b199538e800afb3e193f59aca6808b56722..e0ca3527c1db7893e4a06bb77df2464c838259fd 100644 (file)
@@ -1,3 +1,9 @@
+2010-12-02  Richard Guenther  <rguenther@suse.de>
+            Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/46663
+       * gcc.dg/vect/pr46663.c: New test.
+
 2010-12-02  Jie Zhang  <jie@codesourcery.com>
 
        PR middle-end/46674
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 b55bacb7ec7961cdde4f7638f9643d07c60a150e..d4053044de9b2626f53781fd096e83c276133ff0 100644 (file)
@@ -472,6 +472,9 @@ vect_recog_pow_pattern (gimple last_stmt, tree *type_in, tree *type_out)
     return NULL;
 
   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: