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 5A0933850414; Sun, 20 Dec 2020 17:47:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5A0933850414 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 0BKHlewD007123 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 20 Dec 2020 09:47:40 -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 0BKHlevr007122; Sun, 20 Dec 2020 09:47:40 -0800 (PST) (envelope-from sgk) Date: Sun, 20 Dec 2020 09:47:40 -0800 From: Steve Kargl To: Thomas Koenig Cc: fortran@gcc.gnu.org, kargl@gcc.gnu.org Subject: Re: co-arrays and libgfortran Message-ID: <20201220174740.GA7065@troutmask.apl.washington.edu> References: <20201218042846.GA94181@troutmask.apl.washington.edu> <203c7d27-2303-f887-ea57-11b860f18a8f@netcologne.de> <20201218155252.GB96460@troutmask.apl.washington.edu> <20201219215944.GA3597@troutmask.apl.washington.edu> 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2020 17:47:43 -0000 On Sun, Dec 20, 2020 at 11:52:59AM +0100, Thomas Koenig wrote: > > Hi Steve, > > > Well, one possible solution would have conv_intrinsic_random_init() > > convert random_init(repeatable, image_distinct) into > > > > _gfortran_random_init(repeatable, image_distinct, hidden, sub) > > > > where hidden is the value of this_image() as before, and sub is the > > name (or pointer?) to a subroutine. > > I think it would be easier to do > > if (flag_coarray == GFC_FCOARRAY_LIB) > tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_ random_init, > 3, > arg1, arg2, arg3); > else if (flag_coarray == GFC_FCOARRAY_SHARED) > tmp = build_call_expr_loc (input_location, gfor_fndecl_cas_ random_init, > 3, > arg1, arg2, arg3); > else > tmp = build_call_expr_loc (input_location, gfor_fndecl_random_init, 3, > arg1, arg2, arg3); > > This way, we do not have to change the normal libgfortran, and any > implementation can then do its own thing. > Yes, that would work, too. If arg3 is the 'hidden' argument that gfortran generates for the image number, then it is likely unneeded under your suggestion. Both caf and cas can internally determine this_image() and the 'none' and 'single' know that there is only one image. Hmmm, now that I think about it. I guess we cannot drop the 3rd argument, because it would change the ABI for libgfortran. -- Steve