To: J3 11-119r2
From: John Reid/Stan Whitlock
Subject: Interop: UTI TR12
Date: 2011 February 15
References: N1838
DISCUSSION
Unresolved Technical Issue TR12 points out that paragraph 3 of 2.2
allows an assumed-rank object to be the first argument to an intrinsic
inquiry function and asks what happens if the rank is zero and when a
DIM argument is present.
The only functions involved are LBOUND, UBOUND, SIZE.
SIZE is covered in 3.4.2 - the DIM argument is ignored.
For LBOUND and UBOUND, the text in Fortran 2003 is clear: it requires
1 <= DIM <= n, where n is the rank. I think this is fine since there
is no suitable scalar value for the result. With DIM absent, we get a
zero-sized array, which is the correct result. An edit is supplied to
add a note.
EDIT to N1838:
[6:10+] After the subclause 3.4.3 UBOUND, add
NOTE 3.2
If LBOUND or UBOUND is invoked for an assumed-rank object that is
associated with a scalar and DIM is absent, the result is a zero-sized
array. LBOUND or UBOUND cannot be invoked for an assumed-rank object
that is associated with a scalar if DIM is present because the rank of
a scalar is zero and DIM must be >= 1.