PR23152 - namelist can't contain an assumed size array - a standardsquestion

Richard E Maine Richard.Maine@nasa.gov
Wed Aug 10 19:41:00 GMT 2005


On Aug 10, 2005, at 9:28 AM, Paul Thomas wrote:

> I had taken constant bounds to mean that the range over which the 
> array could be referenced, within the relevant scope, was constant.  
> The assumed size declaration passes no information at all to the scope 
> about the bounds of the matrix; just a base address.  That is why I 
> wrote "definitely".

Oh. Completely wrong direction (IMO). "Constant bounds" means that the 
bounds are all given by "constant expressions" (a category of 
expression removed in f2003 - I think it was 2003 - anyway in one of 
the revisions - it is mostly replaced by initialization expressions)

> Assumed shape arrays, on the other hand, have the bounds fed them by 
> the compiler.

*ALL* arrays have bounds. The compiler might or might not know the 
bounds at compile time. The bounds might even not be known to the 
run-time library at rune time (in the case of assumed size). But the 
array still has bounds; that is a fundamental array concept. Ok, I 
suppose that an unallocated allocatable array or a pointer that is not 
associated might be said to not have bounds (or maybe it has bounds, 
but they are undefined - that's a fine distinction). But nothing about 
the wording in question says anything about "fed them by the compiler".

In f2003 (which is most conveniently at hand), see the definition of 
"bounds" in the glossary, which is "For a named array, the limits 
within which the values of the subscripts of its array elements shall 
lie." Nothing there about "fed to the compiler" of anything like that 
in more formal terms. Also see the 5.1.2.5.1 referenced in the glossary 
entry. There you will find the definitions of the bounds for assumed 
shape and assumed size arrays. Hmm. Reading it myself, I see that it 
does say that an assumed size array has no upper bound in the last 
dimension, but I note that isn't actually consistent with the 
definition of the term "bound", since there is a limit within which the 
subscript is required to lie. Oh well.

Anyway, it is the assumed size case that I guess one could at least 
argue with, on the basis that there isn't an upper bound in the last 
dimension at all, so there isn't a nonconstant bound. I think that 
would be the wrong interpretation, but I can see how someone could get 
it from reading the words of the standard. But an assumed-shape array 
has bounds as described in 5.1.2.5.2.

-- 
Richard Maine                |  Good judgment comes from experience;
Richard.Maine@nasa.gov       |  experience comes from bad judgment.
                             |        -- Mark Twain



More information about the Fortran mailing list