Dear Richard,
Thank you very much for the comprehensive answer in the
face of insufficient detail.
>> : An allocatable array is not allowed in this context.
>
>
> This is insufficient context to tell for sure. In particular, there is
> not enough context to tell whether weight_gt_0 is allowed to be an
> automatic variable or not.
I believe it satisfies all of the criteria for automatic allocation
(local variable to subroutine, not an argument, not saved). Indeed
the code actually compiles and works if the dimension is
alternatively given as a USE associated integer variable.
> Specification expressions may
> not refer to the size of a *LOCAL* allocatable variable. In f95 (I'm
> not going to track down the exact citations for all versions of the
> standard, but the essence of this hasn't changed), that is prohibited
> in section 7.1.6.2 (Specification expression) by item (7)(2nd b)(iii).
> The compiler might possibly be incorrectly applying that restriction.
I think this must be what is happening.
> However, that restriction doesn't apply to variables accessed via USE
> association; in that case, you go down the branch (7)(2nd b)(a) because
> a use-associated variable is a restricted expression by (7)(4).
>
> Sorry for the somewhat legalese citations. That's what it takes to
> track this stuff down in detail. I could elaborate on the above to
> explain it, but that would get a bit long (as if this isn't already
> :-)).
No need for apology. It's what I was hoping for!
> What could keep weight_gt_0 from being automatic? Well, a SAVE
> attribute, either explicit or implicit, would be the first way that
> comes to mind. For example, a DATA statement could implicitly give the
> SAVE attribute. (Being a dummy argument would be another, but dummy
> arguments are different and even though they aren't called automatic,
> they are ok with specification expressions also).
None of this applies.
> All in all, particularly considering that you say it worked with other
> compilers, I'd guess that this is probably a compiler bug, but the data
> presented isn't sufficient for proof of that.
Given what you have written, I think so.
sincerely
Keith Refson
--
Dr Keith Refson,
Building R3
Rutherford Appleton Laboratory
Chilton
Didcot kr AT isise
Oxfordshire OX11 0QX DOT nd DOT rl DOT ac DOT uk
|