public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47720] New: problems with makefile dependency generation using -M
@ 2011-02-13 18:38 kristopher.kuhlman at gmail dot com
  2011-05-24 19:07 ` [Bug fortran/47720] " zbeekman at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: kristopher.kuhlman at gmail dot com @ 2011-02-13 18:38 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: problems with makefile dependency generation using -M
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: kristopher.kuhlman@gmail.com


Created attachment 23327
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23327
two small test codes that illustrate problem

I am in Ubuntu using a trunk build of gfortran from yesterday.

When I try to create makefile dependencies using -M, first it complains that I
need to use CPP to pre-process the code, even though there are no CPP
directives in this code.

The test code compiles file otherwise:

$ gfortran-4.6 -c makegen1.f90
$ gfortran-4.6 -c makegen2.f90
$ gfortran-4.6 -M makegen?.f90
Fatal Error: To enable preprocessing, use -cpp
Fatal Error: To enable preprocessing, use -cpp

secondly, when I add the -cpp flag, I get redundant mentions of use of a common
module.  In this test code it shows up 3 times (see constants.mod mentioned 3
times).  Can gfortran not repeat the same module several times?

$ gfortran-4.6 -cpp -M makegen?.f90
makegen1.o constants.mod: makegen1.f90
makegen2.o utility.mod: makegen2.f90 constants.mod constants.mod \
 constants.mod


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

* [Bug fortran/47720] problems with makefile dependency generation using -M
  2011-02-13 18:38 [Bug fortran/47720] New: problems with makefile dependency generation using -M kristopher.kuhlman at gmail dot com
@ 2011-05-24 19:07 ` zbeekman at gmail dot com
  2011-05-25 19:38 ` kristopher.kuhlman at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zbeekman at gmail dot com @ 2011-05-24 19:07 UTC (permalink / raw)
  To: gcc-bugs

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

Zaak <zbeekman at gmail dot com> changed:

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

--- Comment #1 from Zaak <zbeekman at gmail dot com> 2011-05-24 18:33:33 UTC ---
The page here: http://gcc.gnu.org/wiki/GFortran#GCC4.6 seems to suggest that
you need to specify -cpp. I must admit, however, the documentation for this
features is a bit murky.

I suspect that the module constants shows up three times because it is used in
three procedures in the second module. This is by no means a deficiency. If you
include this in your makefile it will not cause problems. In fact, make has
ways of removing duplicates. gfortran/cpp likely parse your source code and
every time they encounter a use statement ad the module(s) mentioned there to
the list of dependencies.

May I ask what version of gfortran this is? (Trunk build of gfortran from
yesterday is a bit ambiguous) 

The reason I ask is that I am not getting as far as you. on gfortran 4.6.0 if
have a program which uses two modules and dependency listing I get is myprog.0:
myprog.f90 which is less than helpful.


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

* [Bug fortran/47720] problems with makefile dependency generation using -M
  2011-02-13 18:38 [Bug fortran/47720] New: problems with makefile dependency generation using -M kristopher.kuhlman at gmail dot com
  2011-05-24 19:07 ` [Bug fortran/47720] " zbeekman at gmail dot com
@ 2011-05-25 19:38 ` kristopher.kuhlman at gmail dot com
  2011-05-25 19:48 ` kristopher.kuhlman at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kristopher.kuhlman at gmail dot com @ 2011-05-25 19:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Kris <kristopher.kuhlman at gmail dot com> 2011-05-25 19:36:48 UTC ---
(In reply to comment #1)
> May I ask what version of gfortran this is? (Trunk build of gfortran from
> yesterday is a bit ambiguous) 

I was using a build of gfortran from CVS 2/12/2011.

> The reason I ask is that I am not getting as far as you. on gfortran 4.6.0 if
> have a program which uses two modules and dependency listing I get is myprog.0:
> myprog.f90 which is less than helpful.

Using a more recent trunk build (sometime last week), I still get what I
originally posted.

$ gfortran-4.7 -cpp -M makegen?.f90
makegen1.o constants.mod: makegen1.f90
makegen2.o utility.mod: makegen2.f90 constants.mod constants.mod \
 constants.mod

If it is considered to be ok that there is all this duplication, then I guess I
don't have a problem.  Maybe the documentation for this feature could be
cleared up to mention this too?


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

* [Bug fortran/47720] problems with makefile dependency generation using -M
  2011-02-13 18:38 [Bug fortran/47720] New: problems with makefile dependency generation using -M kristopher.kuhlman at gmail dot com
  2011-05-24 19:07 ` [Bug fortran/47720] " zbeekman at gmail dot com
  2011-05-25 19:38 ` kristopher.kuhlman at gmail dot com
@ 2011-05-25 19:48 ` kristopher.kuhlman at gmail dot com
  2011-05-25 20:00 ` zbeekman at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kristopher.kuhlman at gmail dot com @ 2011-05-25 19:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Kris <kristopher.kuhlman at gmail dot com> 2011-05-25 19:45:15 UTC ---
(In reply to comment #2)
> I was using a build of gfortran from CVS 2/12/2011.

I meant SVN, not CVS.


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

* [Bug fortran/47720] problems with makefile dependency generation using -M
  2011-02-13 18:38 [Bug fortran/47720] New: problems with makefile dependency generation using -M kristopher.kuhlman at gmail dot com
                   ` (2 preceding siblings ...)
  2011-05-25 19:48 ` kristopher.kuhlman at gmail dot com
@ 2011-05-25 20:00 ` zbeekman at gmail dot com
  2011-05-25 20:03 ` zbeekman at gmail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zbeekman at gmail dot com @ 2011-05-25 20:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Zaak <zbeekman at gmail dot com> 2011-05-25 19:56:38 UTC ---
I'm not a gfortran dev, but the duplicates are likely due to the fact the the
source code is being parsed and there is need to remove duplicates, since the
output is intended for consumption by make. The idea is to run gfortran -M -cpp
before running gfortran -c to compile the code. Then you can include the .d
files produced with the -M flag in your makefile. See for example:
http://theory.uwinnipeg.ca/localfiles/infofiles/make/make_43.html

I suspect, however, that if you swapped the names of your two files, and
removed all of the .mod files, you will run into the bug posted here:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49149

(Or rename makegen1.f90 to makegen3.f90) You should be able to start with only
source files (no compiled or objects processed by gfortran) and do: 

$ gfortran-4.6 -cpp -M makegen?.f90

If the nighly build, or whatever you're using still has the same bug as 4.6.0
then the above command will complain about missing .mod files, which defeats
the purpose of having such a utility in the first place.

(The goal is to resolve dependencies, but to do this you need some .mod files.
Which ones? well go resolve some dependencies and find out. Oh...wait I can't
resolve dependencies unless I already have them.... in which case I don't need
to resolve them anymore)


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

* [Bug fortran/47720] problems with makefile dependency generation using -M
  2011-02-13 18:38 [Bug fortran/47720] New: problems with makefile dependency generation using -M kristopher.kuhlman at gmail dot com
                   ` (3 preceding siblings ...)
  2011-05-25 20:00 ` zbeekman at gmail dot com
@ 2011-05-25 20:03 ` zbeekman at gmail dot com
  2011-07-24 19:36 ` dfranke at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zbeekman at gmail dot com @ 2011-05-25 20:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Zaak <zbeekman at gmail dot com> 2011-05-25 20:01:01 UTC ---
In comment 4, in the first sentence there is a typo. I meant: 

I'm not a gfortran dev, but the duplicates are likely due to the fact the the
source code is being parsed and there is *NO* need to remove duplicates, since
the
output is intended for consumption by make.


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

* [Bug fortran/47720] problems with makefile dependency generation using -M
  2011-02-13 18:38 [Bug fortran/47720] New: problems with makefile dependency generation using -M kristopher.kuhlman at gmail dot com
                   ` (4 preceding siblings ...)
  2011-05-25 20:03 ` zbeekman at gmail dot com
@ 2011-07-24 19:36 ` dfranke at gcc dot gnu.org
  2013-12-29 13:37 ` dominiq at lps dot ens.fr
  2021-11-21 18:19 ` aldot at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu.org @ 2011-07-24 19:36 UTC (permalink / raw)
  To: gcc-bugs

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

Daniel Franke <dfranke at gcc dot gnu.org> changed:

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

--- Comment #6 from Daniel Franke <dfranke at gcc dot gnu.org> 2011-07-24 19:35:42 UTC ---
See also #44526 (I think there's another related PR somewhere, can't find it
right now).

The -cpp is required as the C preprocesor and libcpp are being used to generate
the Makefile dependencies. As you probably know, in itself Fortran doesn't
really have a concept of a preprocessor.


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

* [Bug fortran/47720] problems with makefile dependency generation using -M
  2011-02-13 18:38 [Bug fortran/47720] New: problems with makefile dependency generation using -M kristopher.kuhlman at gmail dot com
                   ` (5 preceding siblings ...)
  2011-07-24 19:36 ` dfranke at gcc dot gnu.org
@ 2013-12-29 13:37 ` dominiq at lps dot ens.fr
  2021-11-21 18:19 ` aldot at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-12-29 13:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
The duplicate module names are still there at r206227. Is it really a problem?
Should it be documented?


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

* [Bug fortran/47720] problems with makefile dependency generation using -M
  2011-02-13 18:38 [Bug fortran/47720] New: problems with makefile dependency generation using -M kristopher.kuhlman at gmail dot com
                   ` (6 preceding siblings ...)
  2013-12-29 13:37 ` dominiq at lps dot ens.fr
@ 2021-11-21 18:19 ` aldot at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: aldot at gcc dot gnu.org @ 2021-11-21 18:19 UTC (permalink / raw)
  To: gcc-bugs

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

Bernhard Reutner-Fischer <aldot at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aldot at gcc dot gnu.org

--- Comment #9 from Bernhard Reutner-Fischer <aldot at gcc dot gnu.org> ---
To avoid the duplicate module names, we would have to remember which modules we
emitted already (or maybe deps_add_ not when opening and reading the module but
way later).

But, as said, is this really a problem?

As to the fact that -M... requires cpp, we could enable cpp when seeing -M,
yes.
I'm not sure about the implications this has on the source we're reading
though. Maybe none.

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

end of thread, other threads:[~2021-11-21 18:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-13 18:38 [Bug fortran/47720] New: problems with makefile dependency generation using -M kristopher.kuhlman at gmail dot com
2011-05-24 19:07 ` [Bug fortran/47720] " zbeekman at gmail dot com
2011-05-25 19:38 ` kristopher.kuhlman at gmail dot com
2011-05-25 19:48 ` kristopher.kuhlman at gmail dot com
2011-05-25 20:00 ` zbeekman at gmail dot com
2011-05-25 20:03 ` zbeekman at gmail dot com
2011-07-24 19:36 ` dfranke at gcc dot gnu.org
2013-12-29 13:37 ` dominiq at lps dot ens.fr
2021-11-21 18:19 ` aldot at gcc dot gnu.org

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).