Subject: hpff-interpret: a question about common block and equivalence statement

From: Yan Mi <[email-masked]>
Date: Wed, 7 Feb 96 19:47:26 EAT

---------------------------------------------------------------------------
[email-masked] is a mailing list for corrections,
clarifications, and interpretations related to High Performance Fortran.
Instructions for adding or deleting yourself from this list appear at the
bottom of this message.
---------------------------------------------------------------------------

Dear Profassor,
	I am a graduate student of Peking Univ., P.R.China. Now, we are writing
a complier of HPF. I have some trouble, can you help me?
	I am processing COMMON statement and EQUIVALENCE statement, I do not 
know how to process the following examples:
	program comm
		real a				(1)
		common /b/c,d                   (2)
		f=1.0				(3)

	contains
	function xx(ff)
		common /e/a,f			(4)
		common /b/g,z			(5)
		real j,k
		equivalence (c,j)		(6)
		equivalence (a,k)		(7)
	end
	end
on this example, I have some question :
	1. Can I treate the common block 'b' (in statement 5) as a continuation
of the common block 'b' in statement 2?
	2. Are the two 'a' (in statement 1 and statement 4) the same one? What
about 'f' (in statement 3 and statement 4)?
	3. Can I treate the variable 'c' in statement 6 as the same symbol of
'c' in statement 2? What about 'a' in statement 7?

	We will start our winter vocation at this week end. So can you replay 
me before 9th?
	Thanks very much.

					Sinceresly yours
					Feng Xiaobing

---------------------------------------------------------------------------
To (un)subscribe to this list, send mail to
[email-masked].
Leave the subject line blank, and in the body put the line
(un)subscribe <email-address>
---------------------------------------------------------------------------

---

From: <[email-masked]> (Henry Zongaro)
Date: Wed, 7 Feb 1996 18:49:15 -0500 (EST)

>       We will start our winter vocation at this week end. So can you replay

     I hope this reaches you in time:

     1) No, the common block in (5) cannot be treated as a continuation.
        Statement 5 redefines the common block 'b', so 'c' in the main program
        shares storage with 'g' in the internal function, and 'd' in the main
        program shares storage with 'z' in the internal function.
     2) The 'a' variables defined in (1) and (4) are different variables.
        The 'f' variables defined by (3) and (4) are different variables.
     3) The 'c' variables defined by (2) and (6) are different variables.

If you have a copy of the Fortran 90 standard, see Section 12.1.2.2.1.  There
you'll find a list of situations in which host names (like those declared
by (1), (2) and (3)) are not accessible in an internal subprogram or module
subprogram - basically, whenever something with the same name is declared in
the internal or module subprogram.

     I hope this helps.

Thanks,

Henry