Potential fixes for this problem:

renaming all of the fortran files in the directory so that their alphabetical order is also their required compilation order. While this (usually?) works, it appears to depend on undocumented behavior.

resolving the fortran dependencies and figuring out the file order within the go tool. This seems unlikely to happen.

Allowing the specification of files to be compiled (and their order) a la #12953.

Others?

ianlancetaylor
changed the title from
cgo: compilation order of fortran files is significant
to
cmd/go: compilation order of fortran files is significantAug 25, 2017

This comment has been minimized.

Thank you for your response. I understand that it is not meant to be an
all-purpose build tool. I think that most people that propose changes or
new features understand that.
Would it make sense to document that files are fed into the compiler in
alphabetical order, because in this case that is an important detail? Can
it be counted on that this behavior will not change in future releases? Or
is it something that should not be depended on?

This comment has been minimized.

Interesting question. Guaranteeing alphabetical order is not a problem, but at least for C code we would not want to guarantee that the compilations do not occur in parallel. Perhaps for Fortran we could make an exception and serialize the compilations. But that might give us some extra complexity for a very unusual use case.

On Thu, Aug 24, 2017, 10:16 PM Ian Lance Taylor ***@***.***> wrote:
Interesting question. Guaranteeing alphabetical order is not a problem,
but at least for C code we would not want to guarantee that the
compilations do not occur in parallel. Perhaps for Fortran we could make an
exception and serialize the compilations. But that might give us some extra
complexity for a very unusual use case.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#21605 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AF6AAQXSaMld4u1YNz5j4Nh616m1823qks5sblidgaJpZM4PCNBn>
.

This comment has been minimized.

The go tool effectively spawns separate processes gfortran -c a.f, gfortran -c b.f, gfortran -c c.f. Right now it does them in serial, but in the future it might start them all at the same time. That will work fine for C or C++, but, apparently, not for Fortran.