http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45077
--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-02-20 11:39:56 UTC --- (In reply to comment #6) > Fixes the problem. Bootstraps and regtests OK. I glanced at it and it looks OK. > dg-additional-sources is not sufficient is it? That is does it generate: > gfortran source1.f90 source2.f90 > or > gfortran -c source1.f90 -o source1.o > gfortran source2.f90 source1.0 I think both are effectively the same: For "gfortran source2.f90 source1.f90", the driver (gfortran) calls twice the compiler (f951) which generates in /tmp/... the assembler files, the driver then calls the assembler (as) twice and, finally, the linker (collect1). The driver only combined the two source files when "-combined" is used, though I think that feature was not available for Fortran and will not work with dg-additional-sources. That can be seen when running "gfortran -v source2.f90 source1.f90" by looking for the f951 lines. Note: The file specified by dg-additional-sources is compiled after the one which has the "dg-additional-sources" specified. Additionally, one needs to provide a fall-back compilation as the second file is also compiled independently. See pr37287-1.f90 and pr37287-2.F90 as an example.