[J3] [EXTERNAL] Re: VALUE attribute for assumed-shape in an interface with bind C

Reuben D. Budiardja reubendb at ornl.gov
Mon Jan 10 16:23:35 UTC 2022

On 1/10/22 11:11, Steve Lionel via J3 wrote:
> On 1/10/2022 11:00 AM, Reuben D. Budiardja via J3 wrote:
>> Some compilers accept it, some rejects this (unfortunately with 
>> different / confusing error messages). But I couldn't find where this 
>> is disallowed in the standard. In the VALUE attribute section (8.5.19 
>> in 21/007r2) the constraint is only for assumed-size.
> 18.3.6, but as is often the case, you have to see that the standard 
> doesn't provide an interpretation, so it is not allowed.
> Paragraph 2 specifies the conditions under which a procedure interface 
> is interoperable. For a dummy with the VALUE attribute, there is:
> (4) any scalar dummy argument with the VALUE attribute is interoperable 
> with the corresponding formal parameter of the prototype,
> but this is an array, not a scalar. There are no other cases allowing 
> VALUE for non-scalars, therefore this is not permitted.

Thanks Steve. I've looked in this section too, and had similar thought, 
but then, strictly speaking, this can be interpreted as that such 
procedure is not interoperable with C.

Assummed-size is explicitly prohibited in C867 (along with coarray and 
variable with coarray ultimate component). I guess I wonder why 
assumed-shape is not in that list as well.


> Intel Fortran reasonably complains:
> t.f90(5): error #7292: A dummy argument with the VALUE attribute cannot 
> be an array or an array pointer.   [A]
>        integer(c_int), intent(in), dimension(:), value :: A
> ---------------------------------------------------------^
> Steve

Reuben D. Budiardja, Ph.D.
reubendb at ornl.gov | (865) 576-9519
National Center for Computational Sciences
Oak Ridge National Laboratory

More information about the J3 mailing list