(j3.2006) a question on cobounds
Malcolm Cohen
malcolm
Mon Jul 27 20:32:31 EDT 2009
Bill Long wrote:
> Jim Xia wrote:
>
>> For the following declarations
>>
>> subroutine foo (n)
>> integer, intent(in) :: n
>> integer W(n)[*] !<-- we made it clear
>> this is not allowed
>>
>
> Right. Automatic coarrays are not allowed.
>
>
>> * integer, save :: U(10)[N,*] !<-- but do we intend to allow
>> this? I have difficulties in finding constraints/rules that forbid this*
>>
>>
>
> This is allowed. The array U has the same size on all images, and the
> size is known at compile time. The [N,*] only affects how the image
> numbers are computed in references within the subroutine. This case is
> discussed at [92:24-26].
>
Frankly, this looks like shockingly bad design. Like Jim, I never
imagined that something with variable bounds could be static, even if
the size were constant.
C529 says
"(R511) A <lower-cobound> or <upper-cobound> that is not a constant
expression shall appear only in a subprogram, derived type definition,
or interface body."
My followup question is: how can a cobound appear in a derived type
definition? This only applies to R511, which is
<explicit-coshape-spec>, and according to the witter a couple of lines
above this is only for named coarrays, which by definition cannot appear
in a derived type definition.
My followup question 2 relates to the text you quoted, which says
"If an explicit-coshape coarray has cobounds that are not constant
expressions, the cobounds are determined at entry to the procedure ...".
Well, if the definition appears in an interface body or derived type
definition, those are not procedures. Therefore explicit-coshape
coarrays are not allowed in interface bodies or derived type definitions
(seeing as how the standard just got an internal error). That would
seem to be a problem for nonallocatable dummy coarrays.
My followup question 3 relates to the BLOCK construct; viz, this is not
integrated into it. The quoted text says that in
SUBROUTINE s(n) ! Suppose N is equal to 100 on entry.
...
n = 10
BLOCK
REAL,SAVE :: cob[n:*]
cob[n] = 3 ! PROBLEM
that COB is declared with bounds equal to N on entry to the procedure
viz 100, so cob[n] being cob[10] will be an error.
It looks to me that the text and constraints at 92:22-26 are in serious
need of repair.
Cheers,
--
.........................Malcolm Cohen, Nihon NAG, Tokyo.
More information about the J3
mailing list