public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47485] New: gfortran -M output is incorrect when -MT option is used
@ 2011-01-27  8:29 thenlich at users dot sourceforge.net
  2011-01-27 10:57 ` [Bug fortran/47485] " burnus at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: thenlich at users dot sourceforge.net @ 2011-01-27  8:29 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: gfortran -M output is incorrect when -MT option is
                    used
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: thenlich@users.sourceforge.net


When "-MT target" (Change the target of the rule emitted by dependency
generation) is specified, the specified target is added as an additional target
instead of replacing the default one.

Example test.for:
      program test
      print "(a)", "hello world"
      end program

$ gfortran -cpp -M test.for -MT obj/test.o
test.o obj/test.o: test.for

Expected output:
obj/test.o: test.for


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/47485] gfortran -M output is incorrect when -MT option is used
  2011-01-27  8:29 [Bug fortran/47485] New: gfortran -M output is incorrect when -MT option is used thenlich at users dot sourceforge.net
@ 2011-01-27 10:57 ` burnus at gcc dot gnu.org
  2011-01-30 17:50 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-27 10:57 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |dfranke at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-27 08:42:07 UTC ---
The -MT version is added via:

cpp.c's gfc_cpp_init:
      else if (opt->code == OPT_MT || opt->code == OPT_MQ)
        deps_add_target (cpp_get_deps (cpp_in),
                         opt->arg, opt->code == OPT_MQ);

which matches C's handle_deferred_opts in c-family/c-opts.c.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/47485] gfortran -M output is incorrect when -MT option is used
  2011-01-27  8:29 [Bug fortran/47485] New: gfortran -M output is incorrect when -MT option is used thenlich at users dot sourceforge.net
  2011-01-27 10:57 ` [Bug fortran/47485] " burnus at gcc dot gnu.org
@ 2011-01-30 17:50 ` burnus at gcc dot gnu.org
  2011-10-18 16:31 ` nightstrike at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-30 17:50 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/47485] gfortran -M output is incorrect when -MT option is used
  2011-01-27  8:29 [Bug fortran/47485] New: gfortran -M output is incorrect when -MT option is used thenlich at users dot sourceforge.net
  2011-01-27 10:57 ` [Bug fortran/47485] " burnus at gcc dot gnu.org
  2011-01-30 17:50 ` burnus at gcc dot gnu.org
@ 2011-10-18 16:31 ` nightstrike at gmail dot com
  2013-12-29 13:38 ` dominiq at lps dot ens.fr
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: nightstrike at gmail dot com @ 2011-10-18 16:31 UTC (permalink / raw)
  To: gcc-bugs

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

nightstrike <nightstrike at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nightstrike at gmail dot
                   |                            |com

--- Comment #3 from nightstrike <nightstrike at gmail dot com> 2011-10-18 16:29:43 UTC ---
I have just now seen this problem for c and not fortran for GCC 4.1.2.  It
appears fixed in 4.6.0.  I searched the bug database, and found this:

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

It looks like the two bugs are related, although I can confirm that the bug
still exists for gfortran 4.6.0 using the test case provided in this PR:

$ cat > f.f90
program test
print "(a)", "hello world"
end program

$ gfortran -cpp -M f.f90 -MT aaa
f.o aaa: f.f90


So at the very least, can someone set the bug status to NEW (confirmed) and the
See Also to PR12448?

Also, when fixing this, whoever does so, be sure to not run into this snag:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44076

That should be on the See Also, as well.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/47485] gfortran -M output is incorrect when -MT option is used
  2011-01-27  8:29 [Bug fortran/47485] New: gfortran -M output is incorrect when -MT option is used thenlich at users dot sourceforge.net
                   ` (2 preceding siblings ...)
  2011-10-18 16:31 ` nightstrike at gmail dot com
@ 2013-12-29 13:38 ` dominiq at lps dot ens.fr
  2014-08-16 22:43 ` dominiq at lps dot ens.fr
  2023-04-27 14:36 ` volker.weissmann at gmx dot de
  5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-12-29 13:38 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-12-29
     Ever confirmed|0                           |1

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Still present at r206227.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/47485] gfortran -M output is incorrect when -MT option is used
  2011-01-27  8:29 [Bug fortran/47485] New: gfortran -M output is incorrect when -MT option is used thenlich at users dot sourceforge.net
                   ` (3 preceding siblings ...)
  2013-12-29 13:38 ` dominiq at lps dot ens.fr
@ 2014-08-16 22:43 ` dominiq at lps dot ens.fr
  2023-04-27 14:36 ` volker.weissmann at gmx dot de
  5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-08-16 22:43 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jpakkane at gmail dot com

--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
*** Bug 62162 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/47485] gfortran -M output is incorrect when -MT option is used
  2011-01-27  8:29 [Bug fortran/47485] New: gfortran -M output is incorrect when -MT option is used thenlich at users dot sourceforge.net
                   ` (4 preceding siblings ...)
  2014-08-16 22:43 ` dominiq at lps dot ens.fr
@ 2023-04-27 14:36 ` volker.weissmann at gmx dot de
  5 siblings, 0 replies; 7+ messages in thread
From: volker.weissmann at gmx dot de @ 2023-04-27 14:36 UTC (permalink / raw)
  To: gcc-bugs

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

Volker Weißmann <volker.weissmann at gmx dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |volker.weissmann at gmx dot de

--- Comment #6 from Volker Weißmann <volker.weissmann at gmx dot de> ---
Still present in gcc 12.2.1

This bug still creates problems for meson's fortran support.

Please fix.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-04-27 14:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-27  8:29 [Bug fortran/47485] New: gfortran -M output is incorrect when -MT option is used thenlich at users dot sourceforge.net
2011-01-27 10:57 ` [Bug fortran/47485] " burnus at gcc dot gnu.org
2011-01-30 17:50 ` burnus at gcc dot gnu.org
2011-10-18 16:31 ` nightstrike at gmail dot com
2013-12-29 13:38 ` dominiq at lps dot ens.fr
2014-08-16 22:43 ` dominiq at lps dot ens.fr
2023-04-27 14:36 ` volker.weissmann at gmx dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).