[J3] Question on conformance related to dummy argument with TARGET attribute and INTENT(IN) and function result with POINTER attribute
Robert Corbett
rpcorbett at att.net
Tue Jun 18 12:43:51 EDT 2019
Your concern is justified. The program violates 8.5.17 p1 when the pointer assignment is executed.
> On Jun 18, 2019, at 8:34 AM, Vipul Parekh via J3 <j3 at mailman.j3-fortran.org> wrote:
>
> Is the following code conformant? The aspects which raise some
> concerns include the dummy argument in the function with TARGET
> attribute and INTENT(IN) as well as the function result that has the
> POINTER attribute. But there may be other issues with conformance as
> well that I will appreciate if anyone can point out to me.
>
> module m
> type :: t
> private
> integer :: m_i = 0
> contains
> procedure :: i => get_i
> end type
> contains
> function get_i( this ) result(i)
> class(t), target, intent(in) :: this
> integer, pointer :: i
> i => this%m_i
> end function
> end module
> use m, only : t
> type(t) :: foo
> foo%i() = 42
> print *, "foo%i() = ", foo%i(), "; expected is 42"
> end
>
> Two compilers I tried do process the above code without any errors or
> warnings and produce the output:
> foo%i() = 42 ; expected is 42
>
> Thanks much for your time and attention,
> Vipul Parekh
More information about the J3
mailing list