re PR tree-optimization/50039 (Segfault in vect_operation_fits_smaller_type())
authorIra Rosen <ira.rosen@linaro.org>
Thu, 11 Aug 2011 05:43:14 +0000 (05:43 +0000)
committerIra Rosen <irar@gcc.gnu.org>
Thu, 11 Aug 2011 05:43:14 +0000 (05:43 +0000)
        PR tree-optimization/50039
        * tree-vect-patterns.c (vect_operation_fits_smaller_type): Check
        that DEF_STMT has a stmt_vec_info.

From-SVN: r177647

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/no-tree-fre-pr50039.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/vect.exp
gcc/tree-vect-patterns.c

index a727916693fb3c9a286b82b65676583eeac1e61c..f85d349b8e1cd3fbe662087d92c911a363bb3ce2 100644 (file)
@@ -1,3 +1,9 @@
+2011-08-11  Ira Rosen  <ira.rosen@linaro.org>
+
+       PR tree-optimization/50039
+       * tree-vect-patterns.c (vect_operation_fits_smaller_type): Check
+       that DEF_STMT has a stmt_vec_info.
+
 2011-08-10  Richard Guenther  <rguenther@suse.de>
 
        * tree.h (can_trust_pointer_alignment): Remove.
index 03c7c016edf78ef34349e7073cd1341c19615719..4ec4ba1e7f29aa253b9dfa22af120bea212d7840 100644 (file)
@@ -1,3 +1,9 @@
+2011-08-11  Ira Rosen  <ira.rosen@linaro.org>
+
+       PR tree-optimization/50039
+       * gcc.dg/vect/vect.exp: Run no-tree-fre-* tests with -fno-tree-fre.
+       * gcc.dg/vect/no-tree-fre-pr50039.c: New test.
+
 2011-08-10  H.J. Lu  <hongjiu.lu@intel.com>
 
        * gcc.target/i386/sse4_1-blendps-2.c: Include <stdlib.h>.
diff --git a/gcc/testsuite/gcc.dg/vect/no-tree-fre-pr50039.c b/gcc/testsuite/gcc.dg/vect/no-tree-fre-pr50039.c
new file mode 100644 (file)
index 0000000..11c0c70
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+extern unsigned char g_5;
+extern int g_31, g_76;
+int main(void) {
+ int i, j;
+    for (j=0; j < 2; ++j) {
+        g_31 = -3;
+        for (i=0; i < 2; ++i)
+          g_76 = (g_31 ? g_31+1 : 0) ^ g_5;
+    }
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
index fd92da8707c0e855480d4ab7c99cad94a79eb5cc..ab92be47ab86cc0a68f6f9a030108660308b11b7 100644 (file)
@@ -257,6 +257,12 @@ lappend VECT_SLP_CFLAGS "-fno-tree-reassoc"
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-reassoc-bb-slp-*.\[cS\]]]  \
         "" $VECT_SLP_CFLAGS
 
+# -fno-tree-fre
+set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
+lappend DEFAULT_VECTCFLAGS "-fno-tree-fre"
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-fre-*.\[cS\]]]  \
+        "" $DEFAULT_VECTCFLAGS
+
 # Clean up.
 set dg-do-what-default ${save-dg-do-what-default}
 
index ac3afd8986251836e376a15cb18c6c482051eea1..ef6a4fd372d6a8f40e85747bfe9e68c9ffc71437 100644 (file)
@@ -897,7 +897,8 @@ vect_operation_fits_smaller_type (gimple stmt, tree def, tree *new_type,
   else
     {
       first = true;
-      if (!widened_name_p (oprnd, stmt, &half_type, &def_stmt, false))
+      if (!widened_name_p (oprnd, stmt, &half_type, &def_stmt, false)
+          || !vinfo_for_stmt (def_stmt))
         return false;
     }