From patchwork Fri May 29 09:02:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1300551 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49YJVW5rFrz9sSs for ; Fri, 29 May 2020 19:02:26 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CB4963851C19; Fri, 29 May 2020 09:02:22 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 60A72385DC35 for ; Fri, 29 May 2020 09:02:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 60A72385DC35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rguenther@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 12B31AC20 for ; Fri, 29 May 2020 09:02:19 +0000 (UTC) Date: Fri, 29 May 2020 11:02:18 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/95403 - guard vect_init_vector_1 against NULL stmt_info Message-ID: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 X-Spam-Status: No, score=-15.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Bootstrapped / tested on x86_64-unknown-linux-gnu, applied. 2020-05-29 Richard Biener 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);