From patchwork Tue Jun 23 06:17:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 1314919 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=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=C45/fUHE; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 49rbgF26spz9sRR for ; Tue, 23 Jun 2020 16:17:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 822643954C76; Tue, 23 Jun 2020 06:17:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 822643954C76 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592893071; bh=kPCVGgWmCoEQkSdhxVZs1poEfmpOITXIsUSQZYKZjhQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=C45/fUHEAt8wCFN9AGG+dFp4SfcYqO+uShSjQ/fO+u28LzXzIQMTOHtQl1w24cXPK KDPD64wVh1N+qgasut5cyF35Q5GO+4gBdscETNPNha2iu/uex6UsayaolttStHT7ME Yse6d2ay/IUp+P1Zzb/S31UynUfd/7mqpaLPPuLw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from cc-smtpout2.netcologne.de (cc-smtpout2.netcologne.de [IPv6:2001:4dd0:100:1062:25:2:0:2]) by sourceware.org (Postfix) with ESMTPS id 3B8EF394B01E; Tue, 23 Jun 2020 06:17:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3B8EF394B01E Received: from cc-smtpin2.netcologne.de (cc-smtpin2.netcologne.de [89.1.8.202]) by cc-smtpout2.netcologne.de (Postfix) with ESMTP id B567B12A0D; Tue, 23 Jun 2020 08:17:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cc-smtpin2.netcologne.de (Postfix) with ESMTP id BA63E11F14; Tue, 23 Jun 2020 08:17:46 +0200 (CEST) Received: from [2001:4dd7:d9be:0:5ad3:7b3b:4e4a:96b8] (helo=cc-smtpin2.netcologne.de) by localhost with ESMTP (eXpurgate 4.11.6) (envelope-from ) id 5ef19e8a-4f6f-7f0000012729-7f000001aa98-1 for ; Tue, 23 Jun 2020 08:17:46 +0200 Received: from linux-p51k.fritz.box (2001-4dd7-d9be-0-5ad3-7b3b-4e4a-96b8.ipv6dyn.netcologne.de [IPv6:2001:4dd7:d9be:0:5ad3:7b3b:4e4a:96b8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin2.netcologne.de (Postfix) with ESMTPSA; Tue, 23 Jun 2020 08:17:45 +0200 (CEST) To: "fortran@gcc.gnu.org" , gcc-patches Subject: [patch, fortran, committed] Fix PR 95812, ICE in dependency analysis Message-ID: Date: Tue, 23 Jun 2020 08:17:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 Content-Language: de-DE X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, 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: , X-Patchwork-Original-From: Thomas Koenig via Gcc-patches From: Thomas Koenig Reply-To: Thomas Koenig Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hello world, I just committed the attached patch to master as obvious and simple after regression-testing. Will also backport to gcc-10, where the original regression occurred. Regards Thomas Handle AR_FULL vs. AR_FULL in dependency checking. Previously, handling of full vs. full references failed to take AR_FULL vs. AR_FULL into account. A change in dependency checking in gcc 10 created a code path that could lead there; with this patch, this is now correctly handled. gcc/fortran/ChangeLog: 2020-06-23 Thomas Koenig PR fortran/95812 * dependency.c (ref_same_as_full_array): Handle case of AR_FULL vs. AR_FULL. gcc/testsuite/ChangeLog: 2020-06-23 Thomas Koenig PR fortran/95812 * gfortran.dg/dependency_59.f90: New test. diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c index f6c68409e68..7edd5d9010d 100644 --- a/gcc/fortran/dependency.c +++ b/gcc/fortran/dependency.c @@ -2033,6 +2033,8 @@ ref_same_as_full_array (gfc_ref *full_ref, gfc_ref *ref) return false; if (ref->type != REF_ARRAY) return false; + if (ref->u.ar.type == AR_FULL) + return true; if (ref->u.ar.type != AR_SECTION) return false; diff --git a/gcc/testsuite/gfortran.dg/dependency_59.f90 b/gcc/testsuite/gfortran.dg/dependency_59.f90 new file mode 100644 index 00000000000..90c6532392c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dependency_59.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! PR 95812 - this caused an ICE. +! Test case by Jakub Jelinek. + +module test +contains + subroutine foo() + integer :: a(3) + a = 1 + print *, matmul(1*reshape(a,(/3,1/)), reshape((/1,1,1/),(/1,3/))) + end subroutine foo + subroutine bar() + call foo() + end subroutine bar +end module test