From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126238 invoked by alias); 19 May 2016 17:57:32 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 126222 invoked by uid 89); 19 May 2016 17:57:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Help X-HELO: mail-io0-f179.google.com Received: from mail-io0-f179.google.com (HELO mail-io0-f179.google.com) (209.85.223.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 19 May 2016 17:57:20 +0000 Received: by mail-io0-f179.google.com with SMTP id 190so117240648iow.1 for ; Thu, 19 May 2016 10:57:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=TnyVUaM70yUC4VqkCY+EcwK3v0JlMzlaWeKy8Jdqyjg=; b=eIjJa0fOechroPcJ9O2iX3OZdGwysoRx2M79Dqxh6zXqG3kJHHmRLNoRaoB7Jw/BK8 scOiqRGcyQ83ZcusE7QME03AF29pDBW9y57tfrGFvQkOW0KyoYTCbChiLmD/GYFGwGsF JNdREokymW+mNcpx+xuPO3SylLDnHz+tJQjAsxAuPe5RvhthLZtyizk0RSprK/i8JO4Y /qTZAmeFAnONMG48se7M4ENEJwdwG92D7UERpW5bkcrBUG4cyg12d6okq62K0hGDN6ug DSOdYvG93uPoN5MjPJ20fnvXQY/vE8VPnOMsA4yJBt8yM8g5e90pIaFuZWbXWWUIjlL2 LvCA== X-Gm-Message-State: AOPr4FXG5KGN4l752INFZ9NEXBu3EhSIQxyGOEdE4eKU3kSkCkgiyC+GQ4ry0GW5f1Sjtbe2Eb6JK9t1D9Swow== MIME-Version: 1.0 X-Received: by 10.36.89.4 with SMTP id p4mr3908122itb.44.1463680638560; Thu, 19 May 2016 10:57:18 -0700 (PDT) Received: by 10.107.131.221 with HTTP; Thu, 19 May 2016 10:57:18 -0700 (PDT) In-Reply-To: <573CCC33.3040708@sfr.fr> References: <573A283B.6060306@sfr.fr> <573B751C.8000209@sfr.fr> <573CCC33.3040708@sfr.fr> Date: Thu, 19 May 2016 17:57:00 -0000 Message-ID: Subject: Re: [Fortran] Help with intrinsic function returning array From: Alessandro Fanfarillo To: Mikael Morin Cc: gfortran Content-Type: multipart/mixed; boundary=001a11449f66872e62053335b4ac X-IsSubscribed: yes X-SW-Source: 2016-05/txt/msg00053.txt.bz2 --001a11449f66872e62053335b4ac Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-length: 1492 Thanks! I changed the function name from failed_images to _gfortran_caf_failed_images and modified OpenCoarrays accordingly. The attached test case named testFailedImages.f90 works perfectly; the temporary is recognized by the scalarizer an printed correctly. On the other hand, the scalarizer doesn't recognize as array an allocatable array not explicitly allocated (testFailedImages_3.f90). 2016-05-18 14:10 GMT-06:00 Mikael Morin : > Le 17/05/2016 22:20, Alessandro Fanfarillo a =C3=A9crit : >> >> 2016-05-17 13:46 GMT-06:00 Mikael Morin : >> >>> Well, what I was telling was aiming at producing something more like >>> that: >>> _gfortran_caf_failed_images(&failed); >>> It's probably doable that way, but there might be some problems indeed >>> with >>> the scalarizer. Most existing intrinsics functions calling the library >>> can >>> have their result shape inferred before the call. >> >> >> I think it would be much more easy to use a subroutine rather than a >> function. Is there an easy way to >> transform the intrinsic function in a subroutine invocation? >> > Well, all the infrastructure is already there. > You just need to tell that the function returns a non-scalar result. > I attach an incremental patch, whose result I have only visually inspecte= d. > The code generated is not very neat, and does some strange things, but it > has the essential parts. > The setting of the bounds probably need more investigation. > > > --001a11449f66872e62053335b4ac Content-Type: text/x-fortran; charset=US-ASCII; name="testFailedImages_3.f90" Content-Disposition: attachment; filename="testFailedImages_3.f90" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ioehg1wb1 Content-length: 249 cHJvZ3JhbSBmYWlsX2ltYWdlCiAgaW1wbGljaXQgbm9uZQogIGludGVnZXIg OjogZmFpbAogIGludGVnZXIsIGFsbG9jYXRhYmxlIDo6IHRtcF9hKDopCiAg aW50ZWdlciA6OiBtZSxucCxzLHRtcAoKICB0bXBfYSA9IGZhaWxlZF9pbWFn ZXMoKQoKICB3cml0ZSgqLCopIHRtcF9hCmVuZCBwcm9ncmFtIGZhaWxfaW1h Z2UK --001a11449f66872e62053335b4ac Content-Type: application/octet-stream; name="testFailedImages_3.f90.003t.original" Content-Disposition: attachment; filename="testFailedImages_3.f90.003t.original" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ioehg5yz2 Content-length: 2180 ZmFpbF9pbWFnZSAoKQp7CiAgc3RydWN0IGFycmF5MV9pbnRlZ2VyKGtpbmQ9 NCkgdG1wX2E7CgogIHRtcF9hLmRhdGEgPSAwQjsKICB7CiAgICBpbnRlZ2Vy KGtpbmQ9OCkgRC4zNDYxOwogICAgaW50ZWdlcihraW5kPTgpIEQuMzQ2MDsK ICAgIGxvZ2ljYWwoa2luZD00KSBELjM0NTk7CiAgICBsb2dpY2FsKGtpbmQ9 NCkgRC4zNDU4OwogICAgbG9naWNhbChraW5kPTQpIEQuMzQ1NzsKICAgIHN0 cnVjdCBhcnJheTFfaW50ZWdlcihraW5kPTQpIEQuMzQ1NjsKCiAgICB0bXBf YS5kdHlwZSA9IDI2NTsKICAgIEQuMzQ1NiA9IHRtcF9hOwogICAgRC4zNDU2 LmRhdGEgPSAwQjsKICAgIF9nZm9ydHJhbl9jYWZfZmFpbGVkX2ltYWdlcyAo JkQuMzQ1NiwgMEIsIDBCKTsKICAgIEQuMzQ1NyA9IChpbnRlZ2VyKGtpbmQ9 NClbMDpdICogcmV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vcnRyYW5fc3Rfd3JpdGVfZG9uZSAoJmR0X3Bhcm0uMCk7CiAgfQp9CgoK X19hdHRyaWJ1dGVfXygoZXh0ZXJuYWxseV92aXNpYmxlKSkKbWFpbiAoaW50 ZWdlcihraW5kPTQpIGFyZ2MsIGNoYXJhY3RlcihraW5kPTEpICogKiBhcmd2 KQp7CiAgc3RhdGljIGludGVnZXIoa2luZD00KSBvcHRpb25zLjFbOV0gPSB7 NjgsIDEwMjMsIDAsIDAsIDEsIDEsIDAsIDAsIDMxfTsKCiAgX2dmb3J0cmFu X2NhZl9pbml0ICgmYXJnYywgJmFyZ3YpOwogIF9nZm9ydHJhbl9zZXRfYXJn cyAoYXJnYywgYXJndik7CiAgX2dmb3J0cmFuX3NldF9vcHRpb25zICg5LCAm b3B0aW9ucy4xWzBdKTsKICBmYWlsX2ltYWdlICgpOwogIF9nZm9ydHJhbl9j YWZfZmluYWxpemUgKCk7CiAgcmV0dXJuIDA7Cn0KCgo= --001a11449f66872e62053335b4ac Content-Type: text/x-fortran; charset=US-ASCII; name="testFailedImages.f90" Content-Disposition: attachment; filename="testFailedImages.f90" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ioek0jgp2 Content-length: 301 cHJvZ3JhbSBmYWlsX2ltYWdlCiAgaW1wbGljaXQgbm9uZQogIGludGVnZXIg OjogZmFpbAogIGludGVnZXIsIGRpbWVuc2lvbigxMCkgOjogdG1wX2Esc19h CiAgaW50ZWdlciA6OiBtZSxucCxzLHRtcAoKICBpZih0aGlzX2ltYWdlKCkg PT0gMSkgZmFpbCBpbWFnZQoKICBzeW5jIGFsbAoKICB3cml0ZSgqLCopIGZh aWxlZF9pbWFnZXMoKQogIAplbmQgcHJvZ3JhbSBmYWlsX2ltYWdlCg== --001a11449f66872e62053335b4ac--