public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] tree-optimization/95403 - guard vect_init_vector_1 against NULL stmt_info
@ 2020-05-29  9:02 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2020-05-29  9:02 UTC (permalink / raw)
  To: gcc-patches


Bootstrapped / tested on x86_64-unknown-linux-gnu, applied.

2020-05-29  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/95403
	* tree-vect-stmts.c (vect_init_vector_1): Guard against NULL
	stmt_vinfo.

	* gfortran.dg/vect/pr95403.f: New testcase.
---
 gcc/testsuite/gfortran.dg/vect/pr95403.f | 16 ++++++++++++++++
 gcc/tree-vect-stmts.c                    |  2 +-
 2 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gfortran.dg/vect/pr95403.f

diff --git a/gcc/testsuite/gfortran.dg/vect/pr95403.f b/gcc/testsuite/gfortran.dg/vect/pr95403.f
new file mode 100644
index 00000000000..248958b524c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/pr95403.f
@@ -0,0 +1,16 @@
+! { dg-do compile }
+      subroutine deuldlag(xi,et,ze,xlag,xeul,xj,xs)
+      real*8 shp(3,20),xs(3,3),xlag(3,20),xeul(3,20)
+      do i=1,3
+        do j=1,3
+        enddo
+      enddo
+      do i=1,3
+        do j=1,3
+          xs(i,j)=0.d0
+          do k=1,20
+            xs(i,j)=xs(i,j)+xeul(i,k)*shp(j,k)
+          enddo
+        enddo
+      enddo
+      end
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 58fb93d740a..a5f1b52d498 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -1330,7 +1330,7 @@ vect_init_vector_1 (vec_info *vinfo, stmt_vec_info stmt_vinfo, gimple *new_stmt,
 	  basic_block new_bb;
 	  edge pe;
 
-	  if (nested_in_vect_loop_p (loop, stmt_vinfo))
+	  if (stmt_vinfo && nested_in_vect_loop_p (loop, stmt_vinfo))
 	    loop = loop->inner;
 
 	  pe = loop_preheader_edge (loop);
-- 
2.26.2

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-29  9:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29  9:02 [PATCH] tree-optimization/95403 - guard vect_init_vector_1 against NULL stmt_info Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).