From patchwork Wed Sep 11 05:44:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Richard Thomas X-Patchwork-Id: 1160652 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-508812-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="I4EPbiNk"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="oQZ/V+Yl"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46SrTy68lQz9s4Y for ; Wed, 11 Sep 2019 15:45:39 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=UR1sL4NNQ1rawSi61FrJ3pegD01VRYMnRGSCjkUhZB+PHg iTzaF4TT6RJjg2EV+jjULneSLfwJ8AWy1AyVNuBrOjiRfXyZLQhUOqXTXuQ8jApr 06JyEHq17mbZhxztVibH3/c7AJv6uZ2x6pY2hQu6G0solWznI4LnfBD+Qye4E= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=KTzOuf4PmuPAVjpg+x7rwmesXag=; b=I4EPbiNkvtH6sLzNS8Pl TiIkwcV0RBj2Oo6s2uTlN0AkCl3BrBTbAp59QXyQwEKCv5epW9CjKMqPPZ4ZR1Ij 5VCHN6pll4wgb2bFCgS0NrTXGlvZ5cMx3aOdh0qAoUqLTmIa6Y6UZB8TUwrD1dSl pwQl/LaS/7yKn00zejWBjzc= Received: (qmail 109850 invoked by alias); 11 Sep 2019 05:45:26 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 109752 invoked by uid 89); 11 Sep 2019 05:45:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=Hello!, hello! X-HELO: mail-lj1-f171.google.com Received: from mail-lj1-f171.google.com (HELO mail-lj1-f171.google.com) (209.85.208.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Sep 2019 05:45:04 +0000 Received: by mail-lj1-f171.google.com with SMTP id q22so14148183ljj.2; Tue, 10 Sep 2019 22:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=LXE36JbnsLVzUOfi+G7o8ChzK1gafRCqFdT8Ikgkqec=; b=oQZ/V+YlkwQj2EsFEIMz2i8MDD9fnuFLTH5FsJ61Ab8AfF+MHwIHTZfJxGRuTyt+nW RV7CwPHRSyeAboEvLz0vc2WomTAM7E4lQbXJlCMatlCbGpigWX+dLzZ4ZqfRrmfH/uSH /B0UtrjOrgDl8hGiW6IIc906GECckgDd0zJpbjqX50Rh6QCgMjaDpmsA8kwoL1jEq38S c/kjbb1LTUMHGfYsJ6hoifsHRCbcfTGa7ZmWYB9uZk07Kh8WGksgrEZFf7cgTG/FogSt x4MdLysZVq90FMYFFKTrO4BYUfK0f2Vr3yRk+yD7wTyCX/gJNvcBYR3fgkxPZBbzw+/p UCOg== MIME-Version: 1.0 From: Paul Richard Thomas Date: Wed, 11 Sep 2019 06:44:50 +0100 Message-ID: Subject: [Patch, fortran] PR91717 - ICE on concatenating deferred-length character and character literal To: "fortran@gcc.gnu.org" , gcc-patches , Steve Kargl , Thomas Koenig Hi All, I nearly committed this patch as 'obvious' but noticed a fair number of changes in 10-branch in dependency analysis. This is in fact a 10-regression. I'll wait for an OK. Bootstrapped and regtested on FC30/x86_64 - OK to commit? Paul 2019-09-11 Paul Thomas PR fortran/91717 * dependency.c (gfc_dep_resolver): Flag identical components and exit with return value 1 if set and no array refs. 2019-09-11 Paul Thomas PR fortran/91717 * gfortran.dg/dependency_55.f90 : New test. Index: gcc/fortran/dependency.c =================================================================== *** gcc/fortran/dependency.c (revision 275323) --- gcc/fortran/dependency.c (working copy) *************** gfc_dep_resolver (gfc_ref *lref, gfc_ref *** 2096,2101 **** --- 2096,2102 ---- int m; gfc_dependency fin_dep; gfc_dependency this_dep; + bool same_component = false; this_dep = GFC_DEP_ERROR; fin_dep = GFC_DEP_ERROR; *************** gfc_dep_resolver (gfc_ref *lref, gfc_ref *** 2115,2120 **** --- 2116,2123 ---- components. */ if (lref->u.c.component != rref->u.c.component) return 0; + + same_component = true; break; case REF_SUBSTRING: *************** gfc_dep_resolver (gfc_ref *lref, gfc_ref *** 2280,2285 **** --- 2283,2292 ---- if (lref || rref) return 1; + /* This can result from concatenation of assumed length string components. */ + if (same_component && fin_dep == GFC_DEP_ERROR) + return 1; + /* If we haven't seen any array refs then something went wrong. */ gcc_assert (fin_dep != GFC_DEP_ERROR); Index: gcc/testsuite/gfortran.dg/dependency_55.f90 =================================================================== *** gcc/testsuite/gfortran.dg/dependency_55.f90 (nonexistent) --- gcc/testsuite/gfortran.dg/dependency_55.f90 (working copy) *************** *** 0 **** --- 1,17 ---- + ! { dg-do run } + ! + ! Test the fix for PR91717 in which the concatenation operation ICEd. + ! + ! Contributed by Damian Rouson + ! + type core + character (len=:), allocatable :: msg + end type + + type(core) :: my_core + + my_core%msg = my_core%msg//"my message is: " + my_core%msg = my_core%msg//"Hello!" + + if (my_core%msg .ne. "my message is: Hello!") stop 1 + end