Summary: | gfortran should be able to output Makefile dependencies with -M* options | ||
---|---|---|---|
Product: | gcc | Reporter: | Francois-Xavier Coudert <fxcoudert> |
Component: | fortran | Assignee: | Daniel Franke <dfranke> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | CC: | aldot, burnus, dfranke, fago, gcc-bugs, janus, kirr, rwild, tkoenig |
Priority: | P3 | ||
Version: | 4.3.0 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2008-05-25 22:55:39 |
Description
Francois-Xavier Coudert
2007-04-16 10:21:24 UTC
FX, +5 karma for this proposal :) How about USE association? For example $> cat a.f90 module a [...] end module $> cat b.f90 [...] USE a [...] $> gfortran -M a.f90 a.o a.mod: a.f90 $> gfortran -M b.f90 b.o: a.mod b.f90 (Don't have g95 to check its output) (In reply to comment #1) > How about USE association? That's also part of the plan. What about include "foo.f90" and #include "bar.f90" (g95 handles both) And what about include "z.f90" where "z.f90" is foo/z.f90 and is found via gfortran -Jfoo ? (g95 does not handle this and writes: b.o b.mod: b.F90 z.f90) fx, are you still working on this? yet another reason why "-M" as an alias for -J should be dropped and instead proper -M dependency handling should be added is this: $ echo end > foo.f90 && gfortran -o main foo.f90 -v -M Segmentation fault i.e. it isn't user-safe with 4.1.2, 4.2.0 and trunk. (In reply to comment #4) > fx, are you still working on this? Not actively. It's probably not so hard, though: read the file, like we do with -fsyntax-only mode, and parse #file headers. > yet another reason why "-M" as an alias for -J should be dropped and instead > proper -M dependency handling should be added is this: > > $ echo end > foo.f90 && gfortran -o main foo.f90 -v -M > Segmentation fault That's another one. File a new PR (it's probably a simple check that's missing in gfc_handle_module_path_options()). Subject: Re: gfortran should be able to output Makefile dependencies with -M* options On Mon, Jun 04, 2007 at 05:39:48PM -0000, fxcoudert at gcc dot gnu dot org wrote: > > >------- Comment #5 from fxcoudert at gcc dot gnu dot org 2007-06-04 17:39 ------- >(In reply to comment #4) >> fx, are you still working on this? > >Not actively. It's probably not so hard, though: read the file, like we do with >-fsyntax-only mode, and parse #file headers. Yes, without looking i was thinking about for each file, populate a list of provides/needs mods and emit them when a file is done. >> yet another reason why "-M" as an alias for -J should be dropped and instead >> proper -M dependency handling should be added is this: >> >> $ echo end > foo.f90 && gfortran -o main foo.f90 -v -M >> Segmentation fault > >That's another one. File a new PR (it's probably a simple check that's missing >in gfc_handle_module_path_options()). I did not look whether it is calling strlen on NULL or another spot in the option handling, but i will not look at the current meaning of -M, so please feel free to file this if you think it's worth noting it. Thanks, For once, the segfault is in the gfortran driver, not the f951 binary. Backtrace, plus some more debug info: $ gdb ~/bin/gfortran GNU gdb 6.6.90.20070912-debian Copyright (C) 2007 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i486-linux-gnu"... Using host libthread_db library "/lib/i686/cmov/libthread_db.so.1". (gdb) r foo.f90 -v -M Starting program: /home/ig25/bin/gfortran foo.f90 -v -M Program received signal SIGSEGV, Segmentation fault. 0xb7e23513 in strlen () from /lib/i686/cmov/libc.so.6 (gdb) bt #0 0xb7e23513 in strlen () from /lib/i686/cmov/libc.so.6 #1 0x08056b56 in lang_specific_driver (in_argc=0xbfde2b08, in_argv=0xbfde2b04, in_added_libraries=0x8079b94) at ../../../gcc/trunk/gcc/fortran/gfortranspec.c:431 #2 0x0804f910 in process_command (argc=4, argv=0x807e938) at ../../../gcc/trunk/gcc/gcc.c:3581 #3 0x0805364e in main (argc=4, argv=0xbfde2c54) at ../../../gcc/trunk/gcc/gcc.c:6244 (gdb) up #1 0x08056b56 in lang_specific_driver (in_argc=0xbfde2b08, in_argv=0xbfde2b04, in_added_libraries=0x8079b94) at ../../../gcc/trunk/gcc/fortran/gfortranspec.c:431 431 p = XNEWVEC (char, strlen (argv[i + 1]) + 2); (gdb) p i $1 = 4 (gdb) p argv[0] $2 = 0xbfde47c5 "/home/ig25/bin/gfortran" (gdb) p argv[1] $3 = 0xbfde47dd "foo.f90" (gdb) p argv[2] $4 = 0xbfde47e5 "-v" (gdb) p argv[3] $5 = 0xbfde47e8 "-M" (gdb) p argv[4] $6 = 0x0 > Not actively. It's probably not so hard, though: read the file, like we
> do with -fsyntax-only mode, and parse #file headers.
FX, I'm lost here. The flag_syntax_only is not used anywhere in the fortran directory, but only in places like gcc/toplev.c(compile_file) to, as I understand it, e.g. avoid code generation. As I see it, gfortran never knows it does syntax checking only?!
What exactly do you mean by "#file headers"? Preprocessor include directives as
`#include "foo.inc"`?
Last but not least: did you intend to use the mkdeps-interface of libcpp or to craft something on your own?
(In reply to comment #8) > As I see it, gfortran never knows it does syntax checking only?! Exactly. > What exactly do you mean by "#file headers"? Preprocessor include directives as > `#include "foo.inc"`? Yes. These are some of the dependencies, but not all. Fortran include directives are others (probably not too hard to handle), modules are yet another one. > Last but not least: did you intend to use the mkdeps-interface of libcpp or to > craft something on your own? gfortran doesn't use libcpp, but it probably should. There's a PR about that, and I tried to make the switch at some point (I was still a newcomer to gfortran development at that time, so probably somewhere around 4.1/4.2), but didn't succeed. Subject: Bug 31588 Author: pinskia Date: Wed Mar 26 03:32:13 2008 New Revision: 133541 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133541 Log: 2008-03-25 Andrew Pinski <andrew_pinski@playstation.sony.com> PR target/31588 * config/rs6000/rs6000-c.c (rs6000_builtin_type_compatible): Handle error_mark_node's. 2008-03-25 Andrew Pinski <andrew_pinski@playstation.sony.com> PR target/31588 * g++.dg/ext/altivec-15.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/ext/altivec-15.C Modified: trunk/gcc/ChangeLog trunk/gcc/config/rs6000/rs6000-c.c trunk/gcc/testsuite/ChangeLog Ignore comment #10, I entered the wrong number, it should have been 31558. *** Bug 43954 has been marked as a duplicate of this bug. *** Would it be ok to require '-cpp' with '-M' or shall '-M' work without explicit preprocessing enabled? In the latter case, would it be ok to enable preprocessing implicitly? (In reply to comment #13) > Would it be ok to require '-cpp' with '-M' or shall '-M' work without explicit > preprocessing enabled? In the latter case, would it be ok to enable > preprocessing implicitly? "Passing -M to the driver implies -E" - so much for that. Subject: Bug 31588 Author: dfranke Date: Sun Jun 13 16:05:01 2010 New Revision: 160684 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=160684 Log: 2010-06-13 Daniel Franke <franke.daniel@gmail.com> PR fortran/31588 PR fortran/43954 * gfortranspec.c (lang_specific_driver): Removed deprecation warning for -M. * lang.opt: Add options -M, -MM, -MD, -MMD, -MF, -MG, -MP, -MT, -MQ. * lang-specs.h (CPP_FORWARD_OPTIONS): Add -M* options. * cpp.h (gfc_cpp_makedep): New. (gfc_cpp_add_dep): New. (gfc_cpp_add_target): New. * cpp.c (gfc_cpp_option): Add deps* members. (gfc_cpp_makedep): New. (gfc_cpp_add_dep): New. (gfc_cpp_add_target): New. (gfc_cpp_init_options): Initialize new options. (gfc_cpp_handle_option): Handle new options. (gfc_cpp_post_options): Map new options to libcpp-options. (gfc_cpp_init): Handle deferred -MQ and -MT options. (gfc_cpp_done): If requested, write dependencies to file. * module.c (gfc_dump_module): Add a module filename as target. * scanner.c (open_included_file): New parameter system; add the included file as dependency. (gfc_open_included_file): Add the included file as dependency. (gfc_open_intrinsic_module): Likewise. * invoke.texi: Removed deprecation warning for -M. * gfortran.texi: Removed Makefile-dependencies project. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/cpp.c trunk/gcc/fortran/cpp.h trunk/gcc/fortran/gfortran.texi trunk/gcc/fortran/gfortranspec.c trunk/gcc/fortran/invoke.texi trunk/gcc/fortran/lang-specs.h trunk/gcc/fortran/lang.opt trunk/gcc/fortran/module.c trunk/gcc/fortran/scanner.c Fixed in trunk. See PR44526 for a follow-up request for libcpp. Closing. Subject: Bug 31588 Author: jvdelisle Date: Sat Aug 7 16:51:55 2010 New Revision: 162980 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162980 Log: 2010-08-07 Daniel Franke <franke.daniel@gmail.com> 2010-06-13 Daniel Franke <franke.daniel@gmail.com> PR fortran/31588 PR fortran/43954 Backport from mainline: * gfortranspec.c (lang_specific_driver): Removed deprecation warning for -M. * lang.opt: Add options -M, -MM, -MD, -MMD, -MF, -MG, -MP, -MT, -MQ. * lang-specs.h (CPP_FORWARD_OPTIONS): Add -M* options. * cpp.h (gfc_cpp_makedep): New. (gfc_cpp_add_dep): New. (gfc_cpp_add_target): New. * cpp.c (gfc_cpp_option): Add deps* members. (gfc_cpp_makedep): New. (gfc_cpp_add_dep): New. (gfc_cpp_add_target): New. (gfc_cpp_init_options): Initialize new options. (gfc_cpp_handle_option): Handle new options. (gfc_cpp_post_options): Map new options to libcpp-options. (gfc_cpp_init): Handle deferred -MQ and -MT options. (gfc_cpp_done): If requested, write dependencies to file. * module.c (gfc_dump_module): Add a module filename as target. * scanner.c (open_included_file): New parameter system; add the included file as dependency. (gfc_open_included_file): Add the included file as dependency. (gfc_open_intrinsic_module): Likewise. * invoke.texi: Removed deprecation warning for -M. * gfortran.texi: Removed Makefile-dependencies project. Modified: branches/gcc-4_5-branch/gcc/fortran/ChangeLog branches/gcc-4_5-branch/gcc/fortran/cpp.c branches/gcc-4_5-branch/gcc/fortran/cpp.h branches/gcc-4_5-branch/gcc/fortran/gfortran.texi branches/gcc-4_5-branch/gcc/fortran/gfortranspec.c branches/gcc-4_5-branch/gcc/fortran/invoke.texi branches/gcc-4_5-branch/gcc/fortran/lang-specs.h branches/gcc-4_5-branch/gcc/fortran/lang.opt branches/gcc-4_5-branch/gcc/fortran/module.c branches/gcc-4_5-branch/gcc/fortran/scanner.c Subject: Bug 31588 Author: jvdelisle Date: Sun Aug 8 01:59:15 2010 New Revision: 162990 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162990 Log: 2010-08-07 Daniel Franke <franke.daniel@gmail.com> PR fortran/31588 PR fortran/43954 Backport from mainline: * gfortranspec.c (lang_specific_driver): Removed deprecation warning for -M. * lang.opt: Add options -M, -MM, -MD, -MMD, -MF, -MG, -MP, -MT, -MQ. * lang-specs.h (CPP_FORWARD_OPTIONS): Add -M* options. * cpp.h (gfc_cpp_makedep): New. (gfc_cpp_add_dep): New. (gfc_cpp_add_target): New. * cpp.c (gfc_cpp_option): Add deps* members. (gfc_cpp_makedep): New. (gfc_cpp_add_dep): New. (gfc_cpp_add_target): New. (gfc_cpp_init_options): Initialize new options. (gfc_cpp_handle_option): Handle new options. (gfc_cpp_post_options): Map new options to libcpp-options. (gfc_cpp_init): Handle deferred -MQ and -MT options. (gfc_cpp_done): If requested, write dependencies to file. * module.c (gfc_dump_module): Add a module filename as target. * scanner.c (open_included_file): New parameter system; add the included file as dependency. (gfc_open_included_file): Add the included file as dependency. (gfc_open_intrinsic_module): Likewise. * invoke.texi: Removed deprecation warning for -M. * gfortran.texi: Removed Makefile-dependencies project. Modified: branches/gcc-4_4-branch/gcc/fortran/ChangeLog branches/gcc-4_4-branch/gcc/fortran/cpp.c branches/gcc-4_4-branch/gcc/fortran/cpp.h branches/gcc-4_4-branch/gcc/fortran/gfortran.texi branches/gcc-4_4-branch/gcc/fortran/gfortranspec.c branches/gcc-4_4-branch/gcc/fortran/invoke.texi branches/gcc-4_4-branch/gcc/fortran/lang-specs.h branches/gcc-4_4-branch/gcc/fortran/lang.opt branches/gcc-4_4-branch/gcc/fortran/module.c branches/gcc-4_4-branch/gcc/fortran/scanner.c |