(j3.2006) [MPI3 Fortran] Feedback from Fortran J3 meeting

Aleksandar Donev donev1
Wed May 28 15:24:28 EDT 2008


On Wednesday 28 May 2008 12:18, Jim Xia wrote:

> But don't expect TARGET in interface block along will do the trick. ?In
> this case, TARGET is simply ignored.
Let me give an example:

use iso_c_binding
real(c_float), dimension(10), target :: x

call c_routine_1(c_loc(x))
....

call c_routine_2()
x=...

The compiler better not move the "x=" assignment before the procedure 
call---would yours?

Example 2:
------

use iso_c_binding
real(c_float), dimension(10), target :: x

interface
	subroutine c_routine_1(x)
		real(c_float), dimension(10), target :: x
	end subroutine
end interface

call c_routine_1(x)
....

call c_routine_2()
x=... ! Don't move it

The same as example 1---the call to routine 1 can save a pointer to x and 
modify x during the execution of routine 2. This all seems to me to be legal 
and specified by the standard (Fortran + C).

Aleks




More information about the J3 mailing list