From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by sourceware.org (Postfix) with ESMTPS id 09AE23858D32; Thu, 13 Apr 2023 06:18:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 09AE23858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x1036.google.com with SMTP id d22-20020a17090a111600b0023d1b009f52so17097063pja.2; Wed, 12 Apr 2023 23:18:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681366692; x=1683958692; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=iQwndM7Iq+Bavlpf/Qyv+XU7HnvsuVULvrYkUwHcKCM=; b=PWY/b2bsQ/MDo2jMaRvRjJGdIsUkudnMVVPqiEcgMXzRTmGGWfikOSDMXOYYwu6PmD 5PF1JokFErwjMCVZ4bYKawZmk0RGwc8iss/DU2TUsmxa2/GT+hMLIrKk0xIY92GoX/ZA RsKChvQhwcmRtHJANG6i68b0yXedIgxjxabhsVHI+Qice5oFqLTbhaKe0oGHnq5S8zH1 cZUiTsS/kgxB+1/jLTevUQ7AO5QHs0qgDUhKHpcAwwMHIMRr8Sm50lNdU57sagcaUZJ9 jflRIO7WnRZPUb1DZLIC+dhcECmyVqCxGusxmyvBi12fDD/bkjZSt0pN3UBVos6gk9GE 80Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681366692; x=1683958692; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iQwndM7Iq+Bavlpf/Qyv+XU7HnvsuVULvrYkUwHcKCM=; b=dJCE/nBqBCdbpo/vuj+Bx1T+7aIQQ5GUj0cA6LRbe+WvK6Aj5azIq48h/xZVajLZya 4buDNmWW/JR6zFDSMx469ZsWU5IpQjbMIM+sbNLyZ6W7PYbJHfMk06L0ZCs9ve+SNudA UxOrnx/E27dn/V7dML8ffeJzu2bzg3cuQE8FKvtP3aHI9AZCLdVHBZvoJpoOSXUhmWPn WmbXjCbDkD04zdkRiUZzqWZTI6uKGmA0BPdGg9lDBk4cGSe3WnUuzqC+pB98Q4nTJnmz rE3yOJr0Tk+c+JwxtTJC4SiVUHHLGeb6xHdz9toKM91rNvNi+xHZeB390bqvWBiXGLBW njpw== X-Gm-Message-State: AAQBX9fdKuPJHS3/JAi1ql6A0mOlLoqZkW0Tt8/AUmR2H4E2SdHIQdx+ +CDuPOqWsSEFWY8waQ631A7RuAAwqIMhlz24+s8= X-Google-Smtp-Source: AKy350ZwNBlR/KBrax6yS1eRrqqnga81UqFo5HVLYbwdo6e0uS1uWzkhkeW4lwqPxx3c9evwPfpnUfe3S52tNW1k+SQ= X-Received: by 2002:a17:903:3253:b0:1a2:1fd0:226c with SMTP id ji19-20020a170903325300b001a21fd0226cmr266750plb.8.1681366692493; Wed, 12 Apr 2023 23:18:12 -0700 (PDT) MIME-Version: 1.0 References: <2ef9c2f2-2b56-2dd1-15cb-ff3318ea1315@gmx.de> In-Reply-To: <2ef9c2f2-2b56-2dd1-15cb-ff3318ea1315@gmx.de> From: Paul Richard Thomas Date: Thu, 13 Apr 2023 07:18:01 +0100 Message-ID: Subject: Re: [Patch, fortran] PR109451 - ICE in gfc_conv_expr_descriptor with ASSOCIATE and substrings To: Harald Anlauf Cc: "fortran@gcc.gnu.org" , gcc-patches Content-Type: multipart/alternative; boundary="000000000000717f0a05f931b0d7" X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,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: --000000000000717f0a05f931b0d7 Content-Type: text/plain; charset="UTF-8" Hi Harald, That's interesting - the string length '.q' is not set for either of the associate blocks. I'm onto it. Thanks Paul On Wed, 12 Apr 2023 at 20:26, Harald Anlauf wrote: > 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 > > -- "If you can't explain it simply, you don't understand it well enough" - Albert Einstein --000000000000717f0a05f931b0d7--