This is the mail archive of the
mailing list for the GCC project.
Re: [Patch, Fortran, OOP] PR 44962: [OOP] ICE with specification expression SIZE(<CLASS>)
- From: Tobias Burnus <burnus at net-b dot de>
- To: Janus Weil <janus at gcc dot gnu dot org>
- Cc: gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 20 Jul 2010 23:39:16 +0200
- Subject: Re: [Patch, Fortran, OOP] PR 44962: [OOP] ICE with specification expression SIZE(<CLASS>)
- References: <AANLkTikqPGiqzXRyG6BtQGH4X_Bsc5yR6RQQdvDbjLxg@mail.gmail.com>
Janus Weil wrote:
> 2010-07-18 Janus Weil <firstname.lastname@example.org>
> PR fortran/44962
> * array.c (resolve_array_bound): Modify error message.
> * resolve.c (resolve_fl_derived): Call gfc_resolve_array_spec.
These two changes are OK.
> * expr.c (gfc_is_constant_expr): Detect RAND() and IRAND() as
> 3) In gfc_is_constant_expr, I'm adding a special case for the RAND()
> and IRAND() intrinsic functions, which were detected to be constant
> before. [I'm assuming that a "constant expression" is something that
> can be reduced to a constant at compile time, which the random
> functions are clearly not.]
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.)
Howver, I have not quite understood how this maps to expr.c's
Especially, I would expect that gfc_is_constant_expr match an expression
yielding a constant. However, this does not seem to be the case as
specification expressions are allowed. 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.