DOCERR: Code in Manual Incorrect: COMMON and Equivalance (77574)



The information in this article applies to:

  • Microsoft FORTRAN Compiler for MS-DOS 5.1
  • Microsoft FORTRAN compiler for OS/2 5.1

This article was previously published under Q77574

SUMMARY

The sample program on page 132 of Advanced Topics version 5.0, page 105 Advanced Topics version 5.1 is incorrect. The code is as follows:
   integer a(10,20), b(20,30)
   common /cba/a, /cbb/b
   equivalence (a(10,20),b(1,1))
   end
				
The ANSI standard states (p. 165 of REFERENCE manual):

An EQUIVALENCE statement cannot share memory between two different common blocks or between elements of the same common block.

Since the program attempts to equivalence items in two different COMMON blocks, the compiler generates the error:
error F2318: A, B : EQUIVALENCE : in different common blocks

Modification Type:MajorLast Reviewed:10/23/2003
Keywords:KB77574