This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran, OOP] PR 44962: [OOP] ICE with specification expression SIZE(<CLASS>)


Hi Tobias,

> Frankly, I do not quite understand the check. I know
>
> a) "initialization expressions", which in Fortran 90 and 2008 are called
> "constant expressions", i.e. something which can be reduced at compile
> time to a number or string (or an array (constructor) of those).
> b) "Specification expressions", which do not need to be constant, but
> which need to fulfil some criteria (pureness etc.)

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 subpro-
gram, derived type definition, BLOCK construct, or interface body.

I think this restriction is the reason that we sometimes check for
constant expressions (cf. the argument 'check_constant' of
'gfc_resolve_array_spec'). 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?


> The check for intrinsic functions
> I also do not understand. The comment states that a simplified
> expression is required. However, if the intrinsic can be simplified,
> only has a simple number - and no EXPR_FUNCTION any more. And if not,
> well, then the check of the arguments does also not help.

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

Cheers,
Janus

Attachment: pr44962_v3.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]