I don't have a Fortran standard at hand, but this is what I found on the web:

"The FORTRAN standard prohibits using the same variable (or array
 element) more than once in the same CALL statement, if one of the
 associated formal arguments (i.e. associated with the aliased
 actual arguments) is assigned a value during the subprogram call.

An example of such aliasing:

    CALL SUB1(ARRAY, ARRAY(1))

Passing the same variable (or array element) at the same time
 with a CALL statement and in a common block is also prohibited."

In the gamess case, open64 compiler does pass the same address twice in one 
call statement.
Standard does not require compiler to implement copy-in copy-out to enforce the 
parameter-no-alias rule.
So a case like this can be considered as a program bug in my opinion.

-Mei

From: Sun Chan [mailto:sun.c...@gmail.com]
Sent: Thursday, January 27, 2011 3:26 PM
To: Ye, Mei
Cc: Roy Ju; open64-devel@lists.sourceforge.net
Subject: Re: [Open64-devel] Fortran parameter no-alias rule?

easy enough to ascertain, just print the addr of the items in question
Sun
On Fri, Jan 28, 2011 at 7:15 AM, Ye, Mei 
<mei...@amd.com<mailto:mei...@amd.com>> wrote:
That's what I think.

-Mei

From: Roy Ju [mailto:roy_dc...@yahoo.com<mailto:roy_dc...@yahoo.com>]
Sent: Thursday, January 27, 2011 3:09 PM
To: 
open64-devel@lists.sourceforge.net<mailto:open64-devel@lists.sourceforge.net>; 
Ye, Mei
Subject: Re: [Open64-devel] Fortran parameter no-alias rule?

Does this mean that 416.gamess violates the Fortran param no aliasing rule?

Roy

--- On Thu, 1/27/11, Ye, Mei <mei...@amd.com<mailto:mei...@amd.com>> wrote:

From: Ye, Mei <mei...@amd.com<mailto:mei...@amd.com>>
Subject: [Open64-devel] Fortran parameter no-alias rule?
To: 
"open64-devel@lists.sourceforge.net<mailto:open64-devel@lists.sourceforge.net>" 
<open64-devel@lists.sourceforge.net<mailto:open64-devel@lists.sourceforge.net>>
Date: Thursday, January 27, 2011, 10:11 AM

Hello,



I am seeking your opinion on what is the best way to solve a problem that I 
observed.



Compiler assumes that formal parameters based on different symbols in Fortran 
programs are not aliased.  This leads to a runtime error for CPU2006 416.gamess 
when "-Ofast -LNO:fusion=2" is used.



In the following code snippet, formal parameter array "D" and "DO" in 
subroutine "SYMTRD" have the same storage as their corresponding actual 
parameter "X(I40)".  Therefore the read of "D" in the 1st loop must alias with 
the write of "DO" in the 2nd loop.  When the two outermost loops are fused 
together, we got incorrect results.



In summary, the Fortran parameter no-alias rule makes loop transformations 
illegal.



For legality concern, we could rely on interprocedual analysis to track whether 
formal parameters have the same base.  But compiler analysis tends to be 
conservative and therefore could hurt performance.  It might not always be 
feasible to implement "copy-in copy-out" which may hurt performance as well.



Will that be reasonable to treat this as an user error?



Code snippet:

callsite:

CALL SYMTRD(X(I30),X(I40),X(I10),X(I40),X(I60),IA,L1,L1)



callee:

SUBROUTINE SYMTRD(SH,D,DT,DO,DOD,IA,N,NDIM)

 DIMENSION SH(*),D(*),DT(NDIM,*),DO(*),DOD(*),IA(*)

  ......

  DO 140 I = 1,N

         DO 120 J = 1,N

            DTEMP = ZERO

            DO 100 K = 1,N

               IK = IA(I)+K

               IF (I .LT. K) IK = IA(K)+I

               JK = IA(J)+K

               IF (J .LT. K) JK = IA(K)+J

               DTEMP = DTEMP+SH(IK)*D(JK)   // read of D

  100       CONTINUE

            DT(I,J) = DTEMP

  120    CONTINUE

  140 CONTINUE



      IJ = 0

      DO 200 I = 1,N

         DO 180 J = 1,I

            IJ = IJ+1

            DTEMP = ZERO

            DO 160 K = 1,N

               JK = IA(J)+K

               IF (J .LT. K) JK = IA(K)+J

               DTEMP = DTEMP+DT(I,K)*SH(JK)

  160       CONTINUE

            DO(IJ) = DTEMP                 // write of DO

  180    CONTINUE

  200 CONTINUE



-Mei Ye

-----Inline Attachment Follows-----
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d

-----Inline Attachment Follows-----
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net<http://us.mc1620.mail.yahoo.com/mc/compose?to=Open64-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/open64-devel



------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net<mailto:Open64-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/open64-devel

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to