From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by sourceware.org (Postfix) with ESMTPS id 78DEC395C034 for ; Wed, 16 Nov 2022 18:20:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 78DEC395C034 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=troutmask.apl.washington.edu Authentication-Results: sourceware.org; spf=none smtp.mailfrom=troutmask.apl.washington.edu Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.16.1/8.16.1) with ESMTPS id 2AGIKm6D062878 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO) for ; Wed, 16 Nov 2022 10:20:48 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.16.1/8.16.1/Submit) id 2AGIKmPk062877 for fortran@gcc.gnu.org; Wed, 16 Nov 2022 10:20:48 -0800 (PST) (envelope-from sgk) Date: Wed, 16 Nov 2022 10:20:48 -0800 From: Steve Kargl To: Steve Kargl via Fortran Subject: Re: typespec in forall and implied-do Message-ID: Reply-To: sgk@troutmask.apl.washington.edu References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, Nov 15, 2022 at 05:13:19PM -0800, Steve Kargl via Fortran wrote: > > This patch allows the above to compile and execute. > It has only had some light testing, and I do not know > if nested forall and implied-do loops do work. Feel > free to commit as I cannot. > Appears to work for nested forall (at least in the execution part of a subprogram). ! From Section 6.9 of MR&C program foo implicit none integer, parameter :: n = 9 integer i, j integer k integer a(n,n), b(n,n) a = reshape([(i,i=1,n**2)], [n,n]) do k = 1, 9 print '(*(I3))', a(k,:) end do print * b = a forall (i = 1:n-1) forall (j = i+1:n) a(i,j) = a(j,i) ! a is a rank-2 array end forall end forall do k = 1, 9 print '(*(I3))', a(k,:) end do print * a = b forall (integer :: ii = 1:n-1) forall (integer :: jj = ii+1:n) a(ii,jj) = a(jj,ii) ! a is a rank-2 array end forall end forall do k = 1, 9 print '(*(I3))', a(k,:) end do print * end program foo -- Steve