(j3.2006) Fodder for another interp?
Tobias Burnus
burnus
Sat Oct 6 13:23:49 EDT 2012
Van Snyder wrote:
> Consider the little program
>
> real, allocatable :: A(:)
> a = 1.0
> print *, size(a)
> end
>
> What does it print?
>
> 7.2.1.3p3 says "If a variable is or becomes an unallocated allocatable
> variable, it is then allocated with ... if the variable is an array and
> <expr> is a scalar, the same bounds as before.
>
> What bounds did A have before?
>
> Two of my compilers print "Segmentation fault". Another one prints 0.
>
Well, you could also have quoted the sentence before that one (same
paragraph): "If the variable is an unallocated allocatable array, expr
shall have the same rank."
As you violate this restriction, your program seems to be invalid and
both compilers seem to be standard conforming.
Tobias
More information about the J3
mailing list