This is the mail archive of the 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>)

Janus Weil wrote:

> 2010-07-18  Janus Weil  <>
> 	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
> 	non-constant.
> 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
init/restricted/specification/constant expressions.

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.


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