[Info-vax] Fortran
Arne Vajhøj
arne at vajhoej.dk
Wed Dec 5 18:00:01 EST 2018
On 12/5/2018 4:00 PM, Scott Dorsey wrote:
> Simon Clubley <clubley at remove_me.eisner.decus.org-Earth.UFP> wrote:
>> On 2018-12-05, Scott Dorsey <kludge at panix.com> wrote:
>>> But in Fortran someone modifies the common block and recompiles all the
>>> routines that they think uses the common block and then relinks, but
>>> unbeknownst to him there's an .OBJ file hidden in some subdirectory
>>> somewhere which was compiled with the old common block definition.
>>> And now we have a problem which very intermittently pops up in a seemingly
>>> unrelated piece of code using a variable that isn't even in the common block
>>> (but is located in memory right after the common block). Six months of
>>> DEBUG hell later...
>>
>> What happens if you use a module instead of a common definition ?
>>
>> Does that solve this problem in Fortran or do Fortran compilers
>> allow you to link .obj files which have different versions of the
>> same module definition ?
>
> Same problem. These days it's normal practice to put the common block
> in a file and then INCLUDE it as needed. This means every routine always
> has the same common block definitions. This dramatically reduces the number
> of things that can go wrong, but unfortunately the case above is one of the
> big ones still left.
Yes.
But changing something and not rebuilding everything using it
resulting in problems is a general problem.
Arne
More information about the Info-vax
mailing list