aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIra Rosen <ira.rosen@linaro.org>2011-08-11 05:43:14 +0000
committerIra Rosen <irar@gcc.gnu.org>2011-08-11 05:43:14 +0000
commitfb2c2b167238f82d9103b7fb78ad24918548c245 (patch)
tree1fcad82c6c0c74fcfec903c3fef532092fa82d10
parent7746e0a16c01b8646a09c2a2c9e636d397a6e546 (diff)
downloadgcc-fb2c2b167238f82d9103b7fb78ad24918548c245.zip
gcc-fb2c2b167238f82d9103b7fb78ad24918548c245.tar.gz
gcc-fb2c2b167238f82d9103b7fb78ad24918548c245.tar.bz2
re PR tree-optimization/50039 (Segfault in vect_operation_fits_smaller_type())
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
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-tree-fre-pr50039.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect.exp6
-rw-r--r--gcc/tree-vect-patterns.c3
5 files changed, 35 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a727916..f85d349 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 03c7c01..4ec4ba1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..11c0c70
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/no-tree-fre-pr50039.c
@@ -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" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc/testsuite/gcc.dg/vect/vect.exp
index fd92da8..ab92be4 100644
--- a/gcc/testsuite/gcc.dg/vect/vect.exp
+++ b/gcc/testsuite/gcc.dg/vect/vect.exp
@@ -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}
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index ac3afd8..ef6a4fd 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -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;
}