http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-30 
16:44:58 UTC ---
The first target - the one which should not appear - is set via

fortran/cpp.c's gfc_cpp_init_0 -> libcpp's cpp_read_main_file; the latter
contains:
  if (CPP_OPTION (pfile, deps.style) != DEPS_NONE)
      deps_add_default_target (pfile->deps, fname);

For "gcc" this is called, but "d->ntargets" == 1; in case of gfortran it is 0
and thus the extra "<source>.o" is added.

The d->ntargets is incremented via "deps_add_target".

Thus, the problem seems to be that deps_add_target (for -MT) should be called
before libcpp's cpp_read_main_file.

Reply via email to