Hi José,

On 3/3/20 12:50 PM, José Rui Faustino de Sousa wrote:

> I noticed that the size intrinsic does not seem to follow the Fortran

> standard, from my reading of it I would expect the following pseudo

> Fortran to print -7:

> arr(7,*)

> call sub(arr)

>

> subroutine sub(a)

> a(..)

> print *, size(a)

> It prints 0.

Looks like a bug – and the result should be -7;

can you fill a bug report?

See "16.9.179 SIZE (ARRAY [, DIM, KIND])" in the Fortran 2018 standard,

https://j3-fortran.org/doc/year/18/18-007r1.pdf"Result Value.

If DIM is present, the result has a value equal to the extent

of dimension DIM of ARRAY, except that if ARRAY is assumed-rank

an associated with an assumed-size array and DIM is present

with a value equal to the rank of ARRAY, the value is −1."

"If DIM is absent and ARRAY is assumed-rank, the result has a

value equal to PRODUCT(SHAPE(ARRAY, KIND)). Otherwise, the result

has a value equal to the total number of elements of ARRAY."

As the latter invokes "SHAPE" (15.9.172):

"Result Value. The result has a value whose i-th element is equal to

the extent of dimension i of SOURCE, except that if SOURCE is

assumed-rank, and associated with an assumed-size array, the last

element is equal to −1."

Cheers,

Tobias

-----------------

Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany

Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter