diff mbox

Add NULL check for vectype in vectorizable_comparison

Message ID 20160127163604.GC16081@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Ilya Enkovich Jan. 27, 2016, 4:36 p.m. UTC
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 mbox

Patch

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;