(j3.2006) (SC22WG5.4470) [ukfortran] Question on CONTIGUOUS

Malcolm Cohen malcolm
Sun Jun 5 21:00:08 EDT 2011

>Question: Does this program conform to the Fortran 2008 standard?


>Reason: Of three compilers that accept the CONTIGUOUS attribute, one
>rejects the above, and two accept it.

Then one compiler has a bug.

> Given 5.3.7 para 1 I would tend to
>conclude that the code is invalid.

5.3.7p1 does appear on the face of it to be incorrect.  Note that 5.3.7p1 makes 
no requirement on the program or processor (it does not use "shall"), and there 
is no normative text to support its first claim.

There are no requirements in the procedure chapter (12) on the actual argument 
corresponding to a nonpointer CONTIGUOUS dummy (there are requirements on 
contiguous array pointers).

Furthermore, describes what happens with pointer association when a 
pointer is associated with a CONTIGUOUS dummy and the actual is not simply 
contiguous.  That text would be meaningless if we did not allow noncontiguous 
actual arguments for a contiguous dummy.

> From a usability point of view I'd consider it a nice feature if the processor 
> would
> do the necessary copy-in/out if the actual argument is non-contiguous. If the 
> code
> is deemed invalid - why was it decided to not support this?

In fact we did decide to support it.  After all, it's no more work for the 
compiler than what we already required for explicit-shape and assumed-size 
arrays, way back in F90 days.

................................Malcolm Cohen, Nihon NAG, Tokyo. 

More information about the J3 mailing list