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

Jim Xia jimxia
Wed May 28 15:18:14 EDT 2008

j3-bounces at j3-fortran.org wrote on 05/28/2008 01:03:39 PM:

> On Wednesday 28 May 2008 09:56, Craig Rasmussen wrote:
> > I wonder how C does this?  What are the rules for code motion in C?
> The semantics of the language allow for changes to variables to be made 
> through pointers to the variables. Such pointers can be saved and remain 

> valid, so compilers know that changes can happen behind their back. 
> only allows such things if the variable has the TARGET attribute, and 
> changes are made through a Fortran pointer. With the addition of C 
> compilers should assume that calls to C procedures could modify 
> with the TARGET attribute as well. But only during the call, not after 
> call completes. This is my interpretation, at least.

TARGET attribute is for generating aliasing information in most of cases, 
which may disable code motion within the scope that uses the TARGET.  But 
don't expect TARGET in interface block along will do the trick.  In this 
case, TARGET is simply ignored.  BTW for any variable without INTENT(IN) 
attribute, compiler will make an assumption that it may be modified, not 
only to those with TARGET attribute.  So the best way to prevent code 
motion is to pass the object as an actual argument.  For Craig's MPI_Wait 
that doesn't refer to buf, it's tough to prevent code motion that can move 
"buf(1) = 1" around.


Jim Xia

RL Fortran Compiler Test
IBM Toronto Lab at 8200 Warden Ave, Markham, On, L6G 1C7
Phone (905) 413-3444  Tie-line 313-3444
email: jimxia at ca.ibm.com
D2/YF7/8200 /MKM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://j3-fortran.org/pipermail/j3/attachments/20080528/cae9e96b/attachment.html 

More information about the J3 mailing list