This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Add NULL check for vectype in vectorizable_comparison
- From: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 27 Jan 2016 19:36:04 +0300
- Subject: [PATCH] Add NULL check for vectype in vectorizable_comparison
- Authentication-results: sourceware.org; auth=none
Hi,
This is a trivial patch which adds a NULL check for vectype.
We may have a NULL vectype in case of void call. Will commit
as obvious to trunk after testing.
Thanks,
Ilya
--
gcc/
2016-01-27 Ilya Enkovich <enkovich.gnu@gmail.com>
* tree-vect-stmts.c (vectorizable_comparison): Add
NULL check for vectype.
gcc/testsuite/
2016-01-27 Ilya Enkovich <enkovich.gnu@gmail.com>
* gcc.dg/declare-simd.c: New test.
diff --git a/gcc/testsuite/gcc.dg/declare-simd.c b/gcc/testsuite/gcc.dg/declare-simd.c
new file mode 100644
index 0000000..1c71b60
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/declare-simd.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fopenmp-simd" } */
+
+#pragma omp declare simd linear (p2, p3)
+extern void fn2 (float p1, float *p2, float *p3);
+
+float *a, *b;
+void fn1 (float *p1)
+{
+ int i;
+#pragma omp simd
+ for (i = 0; i < 1000; i++)
+ fn2 (p1[i], a + i, b + i);
+}
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 1dcd129..fa4a364 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -7764,7 +7764,7 @@ vectorizable_comparison (gimple *stmt, gimple_stmt_iterator *gsi,
if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
return false;
- if (!VECTOR_BOOLEAN_TYPE_P (vectype))
+ if (!vectype || !VECTOR_BOOLEAN_TYPE_P (vectype))
return false;
mask_type = vectype;