public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <burnus@net-b.de>
To: Janus Weil <janus@gcc.gnu.org>
Cc: gfortran <fortran@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch, Fortran, OOP] PR 44962: [OOP] ICE with specification 	expression SIZE(<CLASS>)
Date: Wed, 21 Jul 2010 22:48:00 -0000	[thread overview]
Message-ID: <4C477930.5060702@net-b.de> (raw)
In-Reply-To: <AANLkTimDPrbDIOXWM3d2RojHNFVY6PMgsre-mhFAxJNi@mail.gmail.com>

Hi Janus,

Janus Weil wrote:
>> Frankly, I do not quite understand the check. [...]
>>     
> Well, in general array bounds are only required to be specification
> expressions (F08:R516-518). However, there is an additional
> constraint. In F03 it was:
>
> C542 (R511) An explicit-shape array whose bounds are not
> initialization expressions shall be a dummy argument, a function
> result, or an automatic array of a procedure.
>
> In F08 it is:
>
> C531 (R516) An explicit-shape-spec whose bounds are not constant expressions shall appear only in a subprogram, derived type de\ffinition, BLOCK construct, or interface body.
>   

Can you add a comment before the gfc_is_constant_expr to state what the
function is actually doing (e.g. checking for specification expressions
while taking additionally the given constraints into account.)

> If I am interpreting the above restrictions correctly, then components
> had to have constant array bounds in F03, while in F08 they don't have
> to be constant. Is that right?

Seems so, but I somehow do not understand how this is supposed to work;
probably somehow like:

subroutine foo(n)
  type t
    integer :: a(n)
  end type t
...
end


> Good point. So, what do you think about this new version of the patch?
> I will regtest it now ...
>   

Somehow also the references look wrong. If I look at

check_specification_function

it claims that this is: "F95, 7.1.6.2; F2003, 7.1.7", but F2003's 7.1.7
is about initialization expressions; I assume it should be 7.1.6
(specification expressions).
(Please correct as well.)

As you check for specification expressions, you cannot simply remove the
check. The reason is that check_specification_function excludes
intrinsic functions (cf. "specification function" in the standard).
Thus, you still need to check for:

(7) A specification inquiry where each designator or function argument
is [...]
(8) A reference to any other standard intrinsic function where each
argument is a restricted expression,

I do not think that one needs to exclude the random functions (who says
that the array size needs to be deterministic). But I still do not
understand why there is currently a check for having minimally a single
argument.

Regarding your example: It seems to be valid in F2008 (assuming that
"irand()" is regarded as specification expression) but it seems to be
invalid in F2003 due to C542...

I think allowing non-constant local types will be fun for extensible
types and dynamic types, which - using BLOCK and internal functions one
can easily use.

Tobias

  parent reply	other threads:[~2010-07-21 22:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-18 16:36 Janus Weil
2010-07-18 17:28 ` Steve Kargl
2010-07-18 17:55   ` Janus Weil
2010-07-18 18:46     ` Steve Kargl
2010-07-18 19:00       ` Janus Weil
2010-07-20 21:39 ` Tobias Burnus
2010-07-21 21:23   ` Janus Weil
2010-07-21 22:20     ` Janus Weil
2010-07-21 22:48     ` Tobias Burnus [this message]
2010-07-22 20:58       ` Janus Weil
2010-07-23 11:37         ` Janus Weil
2010-07-26  6:15         ` Tobias Burnus
2010-07-29 20:18           ` Janus Weil
2010-07-29 21:07             ` Janus Weil
2010-07-18 18:54 Dominique Dhumieres
2010-07-26  7:20 Dominique Dhumieres

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=4C477930.5060702@net-b.de \
    --to=burnus@net-b.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=janus@gcc.gnu.org \
    /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).