From: Andre Vehreschild <vehre@gmx.de>
To: Steve Kargl <sgk@troutmask.apl.washington.edu>
Cc: GCC-Patches-ML <gcc-patches@gcc.gnu.org>,
GCC-Fortran-ML <fortran@gcc.gnu.org>,
Paul Richard Thomas <paul.richard.thomas@gmail.com>
Subject: Re: [RFC, Fortran, (pr66775)] Allocatable function result
Date: Fri, 10 Jul 2015 09:44:00 -0000 [thread overview]
Message-ID: <20150710114432.2adff6d8@vepi2> (raw)
In-Reply-To: <20150709194131.GA29199@troutmask.apl.washington.edu>
Hi all,
this means that pr66775 is to be closed as resolved invalid, because the
current implementation is alright, but only the program to compile is garbage.
Ok, suits me.
- Andre
On Thu, 9 Jul 2015 12:41:31 -0700
Steve Kargl <sgk@troutmask.apl.washington.edu> wrote:
> On Thu, Jul 09, 2015 at 08:59:08PM +0200, Andre Vehreschild wrote:
> > Hi Steve,
> >
> > Thanks for your knowledge. Can you support your statement that an
> > allocatable function has to return an allocated object by a part of the
> > standard? I totally agree with you that this code is ill-designed, but IMO
> > is it not the task of the compiler to address ill design. The compiler has
> > to comply to the standard and the standard allows allocatable objects to be
> > unallocated. So why has the result of a function be allocated always?
> >
> > Regards,
> > Andre
> >
>
> I think the following excerpts from F2008 are the relevant
> clauses, especially the 2nd to last sentence in the excerpt
> from 12.6.2.2.
>
> ! 12.5.3
> !
> ! When execution of the function is complete, the value of
> ! the function result is available for use in the expression
> ! that caused the function to be invoked.
> !
> ! 12.6.2.2
> !
> ! If RESULT appears, the name of the result variable of the
> ! function is result-name and all occurrences of the function
> ! name in execution-part statements in its scope refer to the
> ! function itself. If RESULT does not appear, the name of the
> ! result variable is function-name and all occurrences of the
> ! function name in execution-part statements in its scope are
> ! references to the result variable. The characteristics (12.3.3)
> ! of the function result are those of the result variable. On
> ! completion of execution of the function, the value returned is
> ! that of its result variable. If the function result is a pointer,
> ! the shape of the value returned by the function is determined by
> ! the shape of the result variable when the execution of the function
> ! is completed. If the result variable is not a pointer, its value
> ! shall be defined by the function. If the function result is a
> ! pointer, on return the pointer association status of the result
> ! variable shall not be undefined.
>
--
Andre Vehreschild * Email: vehre ad gmx dot de
next prev parent reply other threads:[~2015-07-10 9:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-09 10:25 Andre Vehreschild
2015-07-09 17:50 ` Steve Kargl
2015-07-09 18:59 ` Andre Vehreschild
2015-07-09 19:41 ` Steve Kargl
2015-07-10 9:44 ` Andre Vehreschild [this message]
2015-07-10 13:41 ` Steve Kargl
2015-07-10 16:20 ` Mikael Morin
2015-07-10 16:44 ` Andre Vehreschild
2015-07-10 18:57 ` Steve Kargl
2015-07-11 10:37 ` Andre Vehreschild
2015-07-11 11:06 ` Mikael Morin
2015-07-11 11:58 ` Dan Nagle
2015-07-13 17:27 ` Mike Stump
2015-07-11 10:54 ` Mikael Morin
2015-07-11 10:58 ` Andre Vehreschild
2015-07-11 15:37 ` Steve Kargl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150710114432.2adff6d8@vepi2 \
--to=vehre@gmx.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=paul.richard.thomas@gmail.com \
--cc=sgk@troutmask.apl.washington.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).