------- Comment #5 from iwan at irs dot phy dot nrc dot ca 2005-10-29 01:52 ------- Subject: Re: Fortran I/O to same unit number in main program and in a shared library
I guess, it all comes down to what is a "program". If I look at section 5.5.2.3 of the 2003 Standard about common blocks, I find that "Within a program, the common block storage sequences of of all non-zero sized common blocks with the same name have the same first storage unit...". Yet, if I have common/a/ in some subroutine and create a shared library using -Wl,-Bsymbolic (or whatever linker options are needed to make symbols local to the shared library), this is not the same common block as common/a/ in the main program using the shared library. Therefore, if one takes the standard seriously, the shared library is not part of the program in this case and therefore I/O in the shared library should not interfere with I/O in the main program. This is the behavior one gets with the Intel and PGI compilers on Linux and this is the behavior I remember from years ago on IRIX and SunOS workstations. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24576