tree-optimization/95403 - guard vect_init_vector_1 against NULL stmt_info
authorRichard Biener <rguenther@suse.de>
Fri, 29 May 2020 08:16:38 +0000 (10:16 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 29 May 2020 09:02:29 +0000 (11:02 +0200)
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 [new file with mode: 0644]
gcc/tree-vect-stmts.c

diff --git a/gcc/testsuite/gfortran.dg/vect/pr95403.f b/gcc/testsuite/gfortran.dg/vect/pr95403.f
new file mode 100644 (file)
index 0000000..248958b
--- /dev/null
@@ -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
index 58fb93d740a5a7ac30b9266fa76306cfe7422471..a5f1b52d498cbb4f683a75e7bd7efde3ad06ed71 100644 (file)
@@ -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);