Re: a weird COMMON fact



analyst41@xxxxxxxxxxx wrote:

I have been running code foreever that had

common /name1/var1,var2
common /name1/var3,var4,var5
in the same sub-program.

A common block can be declared in pieces. Your two pieces are equivalent to

common /name1/var1,var2,var3,var4,var5


The intent was, of course, to call the second common /name2/.

I corrected it and the results are still the same, because
var3,var4,var5 occur only in that sub-program (I haven't gotten round
to doing whatever I was planning to do with var3-5.)

Why doesn't the compiler (Lahey) flag this as an error or at least as
a warning?

There is no reason to, since a many-piece COMMON statement is allowed, even
it it is not commonly used.

-- mecej4
.



Relevant Pages

  • Re: COMMON and IMPLICIT NONE
    ... depend on me and I am forced to use a COMMON Block. ... your implicit none. ... an "include file" which has both a common statement and a number ...
    (comp.lang.fortran)
  • a weird COMMON fact
    ... common /name1/var3,var4,var5 ... The intent was, of course, to call the second common /name2/. ... var3,var4,var5 occur only in that sub-program (I haven't gotten round ...
    (comp.lang.fortran)
  • Re: a weird COMMON fact
    ... common /name1/var1,var2 everywhere except one sub-program where it was ... And it compiles just fine. ... the second statement simply extends the named common NAME1 just as if it had been written as ...
    (comp.lang.fortran)
  • Re: a weird COMMON fact
    ... common /name1/var3,var4,var5 ... The intent was, of course, to call the second common /name2/. ... var3,var4,var5 occur only in that sub-program (I haven't gotten round ... The list following each successive appearance of the same common block name is treated as a continuation of the list for the block associated with that name. ...
    (comp.lang.fortran)
  • Re: a weird COMMON fact
    ... common /name1/var3,var4,var5 ... The intent was, of course, to call the second common /name2/. ... var3,var4,var5 occur only in that sub-program (I haven't gotten round ... The list following each successive appearance of the same common block name is treated as a continuation of the list for the block associated with that name. ...
    (comp.lang.fortran)