https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42568

--- Comment #31 from urbanjost at comcast dot net ---
It may be of interest that the original application where this was encountered
was changed to use modules, which I have had no similar problem with on Cygwin;
but that the bug1.sh attachment still fails using gfortran 5.4.0 on Cygwin
2.7.0. 

Over the intervening time we found that the EXTERNAL statement was required on
several other PEs (Programming Environments). So it seems the explicit EXTERNAL
statement was used as a flag to scan and use the libraries listed on the loads
or to insert some type of work-around.

I would suggest any QA of a solution also test using shared libraries where
supported, as another compiler did not have this issue with static libraries
but had what manifested as the same symptoms when using shared libraries (since
fixed). 

AThe Fortran standard gives some contrary indications (as I see it) on what

   external BLOCK_DATA_NAME

means. Section 12.4.3.5 implies to me that if a matching BLOCKDATA name
is not found at load time that an error should occur (which implies it
should be searched for in the files presented to the loader); and that is
what I have seen with other compilers/loaders.

     12.4.3.5     EXTERNAL statement

   1 An EXTERNAL statement specifies the EXTERNAL attribute (5.3.9) for a list
of names.

     R1210 external-stmt                    is   EXTERNAL [ :: ]
external-name-list

   2 The appearance of the name of a block data program unit in an EXTERNAL
statement confirms that the block
     data program unit is a part of the program.

But then a note in the standard gives the impression a plain BLOCK DATA
does not by itself imply much:

     C.8.1     Main program and block data program unit (11.1, 11.3)
   1 The name of the main program or of a block data program unit has no
explicit use within the Fortran language.
     It is available for documentation and for possible use by a processor.

To me, this explains why some compilers/loaders only work when there is
an explicit EXTERNAL statement (C.8.1 is only talking about the name in
the declaration of the BLOCK DATA; not in an EXTERNAL statement).

Some old CDC and old CRAY Fortran 77 documentation (not current CRAY
documents -- this was from around the time the XMP came out) explicitly
stated that to ensure a BLOCK DATA is loaded when the use and declaration
are not in the same file that the EXTERNAL statement was required;
but I couldn't find anything else that was that clear about the issue.
s regards the Fortran standard and why I think it does say this should work
(aside from the fact it appears to work everywhere else I tried) ...


I think I can summarize that by saying it is as clear as mud, but if it doesn't
mean that what else would "external BLOCK_DATA_NAME" mean?

Reply via email to