]> 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 08:15:33 +0000 (08:15 +0000)
committerIra Rosen <irar@gcc.gnu.org>
Sun, 5 Dec 2010 08:15:33 +0000 (08:15 +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: r167469

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

index a1c6769085f1760188c2c7c25fb61e7623c1e442..a786b2397073eb28b1d42caa1eff53e91afcb04f 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-12-03  Jason Merrill  <jason@redhat.com>
 
        PR debug/46123
index 4809394410d3eb2f25bd4a9fe8e40ece79b06228..3e35222e6973fc749ea0050a5da68b2a5bb0dff5 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-12-04  Daniel Kraft  <d@domob.eu>
 
        PR fortran/46794
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 2541a53465e683e8d01633363542b72d5fd53dca..f09afa0fd713b6508f6cdbff04e880ed6ef16230 100644 (file)
@@ -469,6 +469,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: