This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/47485] gfortran -M output is incorrect when -MT option is used
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 30 Jan 2011 16:45:19 +0000
- Subject: [Bug fortran/47485] gfortran -M output is incorrect when -MT option is used
- Auto-submitted: auto-generated
- References: <bug-47485-4@http.gcc.gnu.org/bugzilla/>
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.