From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by sourceware.org (Postfix) with ESMTPS id 097DD3857706 for ; Wed, 12 Apr 2023 19:26:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 097DD3857706 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=m.gmane-mx.org Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1pmg79-0004mV-EI for gcc-patches@gcc.gnu.org; Wed, 12 Apr 2023 21:26:43 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: gcc-patches@gcc.gnu.org From: Harald Anlauf Subject: Re: [Patch, fortran] PR109451 - ICE in gfc_conv_expr_descriptor with ASSOCIATE and substrings Date: Wed, 12 Apr 2023 21:26:36 +0200 Message-ID: <2ef9c2f2-2b56-2dd1-15cb-ff3318ea1315@gmx.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Content-Language: en-US In-Reply-To: Cc: fortran@gcc.gnu.org X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Message-ID: <20230412192636.iAh-FqYsrFh4Y9Bghcb-GdfEb0xVRrkqiBJVi5fOdjo@z> Hi Paul, On 4/12/23 17:25, Paul Richard Thomas via Gcc-patches wrote: > Hi All, > > I think that the changelog says it all. OK for mainline? this looks almost fine, but still fails if one directly uses the dummy argument as the ASSOCIATE target, as in: program p implicit none character(4) :: c(2) = ["abcd","efgh"] call dcs0 (c) ! call dcs0 (["abcd","efgh"]) contains subroutine dcs0(a) character(len=*), intent(in) :: a(:) print *, size(a),len(a) associate (q => a(:)) print *, size(q),len(q) end associate associate (q => a(:)(:)) print *, size(q),len(q) end associate return end subroutine dcs0 end This prints e.g. 2 4 2 0 2 0 (sometimes I also get junk values for the character length). Can you please have another look? Thanks, Harald > Paul > > Fortran: Fix some deferred character problems in associate [PR109451] > > 2023-04-07 Paul Thomas > > gcc/fortran > PR fortran/109451 > * trans-array.cc (gfc_conv_expr_descriptor): Guard expression > character length backend decl before using it. Suppress the > assignment if lhs equals rhs. > * trans-io.cc (gfc_trans_transfer): Scalarize transfer of > associate variables pointing to a variable. Add comment. > > > gcc/testsuite/ > PR fortran/109451 > * gfortran.dg/associate_61.f90 : New test