Hello, Like with gcc and g++, for compiling .F sources with gfortran, I thankfully use automatic dependencies generator built into gcc's cpp. E.g. for $ cat test.F #include "test.h" program test print *,'Hello World!' print *,ZZZ end $ cat test.h #define ZZZ 'Hello up there qqq!' gfortran-4.3 correctly generates .d file for make: $ gfortran-4.3 -Wp,-MD,test.d test.F $ cat test.d test.o: test.F test.h but gfortran-4.4 fails: $ rm test.d $ gfortran-4.4 -Wp,-MD,test.d test.F f951: warning: command line option "-MD" is valid for C/C++/ObjC/ObjC++ but not for Fortran $ cat test.d cat: test.d: No such file or directory I think gfortran-4.4 behaviour is incorrect, since .F files (contrast with .f) by definition should be passed through preprocessor, and if so, why dropping automatic dependencies generation which worked in 4.3? I guess the regression is somehow related to the fact, that starting from gcc-4.4, "GNU Fortran now employs libcpp directly instead of using cc1 as an external preprocessor." [1] $ gfortran-4.3 -v -Wp,-MD,test.d test.F Driving: gfortran-4.3 -v -Wp,-MD,test.d test.F -lgfortranbegin -lgfortran -lm -shared-libgcc ... gcc version 4.3.4 (Debian 4.3.4-6) COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' /usr/lib/gcc/i486-linux-gnu/4.3.4/cc1 -E -lang-fortran -traditional-cpp -D_LANGUAGE_FORTRAN -quiet -v -MD test.d test.F -mtune=generic -o /tmp/cclR3nYK.f ... /usr/lib/gcc/i486-linux-gnu/4.3.4/f951 /tmp/cclR3nYK.f -ffixed-form -quiet -dumpbase test.F -mtune=generic -auxbase test -version -fpreprocessed -fintrinsic-modules-path /usr/lib/gcc/i486-linux-gnu/4.3.4/finclude -o /tmp/cc0ZnWFl.s (compare to) $ gfortran-4.4 -v -Wp,-MD,test.d test.F Driving: gfortran-4.4 -v -Wp,-MD,test.d test.F -lgfortranbegin -lgfortran -lm -shared-libgcc ... gcc version 4.4.3 20100108 (prerelease) (Debian 4.4.2-9) COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=i486' /usr/lib/gcc/i486-linux-gnu/4.4.3/f951 test.F -ffixed-form -cpp /tmp/ccE2JRYl.f90 -quiet -v -MD test.d test.F -quiet -dumpbase test.F -mtune=generic -march=i486 -auxbase test -version -fintrinsic-modules-path /usr/lib/gcc/i486-linux-gnu/4.4.3/finclude -o /tmp/ccwptNMx.s f951: warning: command line option "-MD" is valid for C/C++/ObjC/ObjC++ but not for Fortran And since -MD was declared to be C/C++/ObjC/ObjC++ only option for ages (at least since 2003-06-01 d821d2 in gcc.git), now for 4.4. it does not work. It worked for 4.3 because there `cc1 -E` is explicitly called as separate step... And for 4.4. calling cc1 explicitly works too $ /usr/lib/gcc/i486-linux-gnu/4.4.3/cc1 -E -D_LANGUAGE_FORTRAN -quiet -v -MD test.d test.F -o test.f $ cat test.d test.o: test.F test.h but is of no help because cc1 is internal. -------- Clearly this is functional regression to me. If possible please fix. Thanks beforehand, Kirill P.S. this is somehow related to bug #31588 [1] http://gcc.gnu.org/gcc-4.4/changes.html [2] http://git.infradead.org/gcc.git/commit/d821d2e95e00a93f2edb5f6d3decc9c83ceb9c61 $ gfortran-4.4 -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.2-9' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-targets=all --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.4.3 20100108 (prerelease) (Debian 4.4.2-9)
If real life allows, I'll give it another try for 4.6 - started twice already but there are quite a few options to handle. However, if you feel like it, dig in. Help is always welcome :) Closing as dupe of PR31588. *** This bug has been marked as a duplicate of 31588 ***
Daniel, thanks for reply. As I see it, yes, PR31588 would be handy enhancement, but this bug is different -- it's a _regression_ -- it used to work in 4.3 and stopped in 4.4. And when I say "it used to work" I don't mean generating dependencies for f90/f95 sources (PR31588 mentions e.g. USE), but only generating dependencies from plain preprocessor. Please, let's not break what used to work. Is it ok reopen? P.S. I'd like to help as time permits, but hacking on GCC codebase is out of my skills at present. If that would help I'm able and will be glad to try patches and do other testing as well. Sorry and thanks, Kirill
(In reply to comment #2) On Monday 03 May 2010 21:23:26 you wrote: > And when I say "it used to work" I don't mean generating dependencies for > f90/f95 sources (PR31588 mentions e.g. USE), but only generating > dependencies from plain preprocessor. What you ask for is "just" a subset of PR31588. If that gets fixed, your request will be fixed as well. Feel free to re-open if you believe that it would be worth to fix the subset first. > If that would help I'm able and will be glad to try patches and do > other testing as well. I'll keep that in mind :)
On Mon, May 03, 2010 at 07:45:20PM -0000, dfranke at gcc dot gnu dot org wrote: > (In reply to comment #2) > On Monday 03 May 2010 21:23:26 you wrote: > > And when I say "it used to work" I don't mean generating dependencies for > > f90/f95 sources (PR31588 mentions e.g. USE), but only generating > > dependencies from plain preprocessor. > > What you ask for is "just" a subset of PR31588. If that gets fixed, your > request will be fixed as well. > > Feel free to re-open if you believe that it would be worth to fix the subset > first. Yes, it's a subset of PR31588. But as you wrote PR31588 is going to be (maybe) fixed for 4.6, while I believe regressions in general and this one in particular should be better handled with higher priority and fixes should go to maintanance branches. Also, my impression is that PR31588 is more work than fixing "just" this subset. That's why I'm reopening it. Sorry if I ask for too much, especially when I can't help with code... > > If that would help I'm able and will be glad to try patches and do > > other testing as well. > > I'll keep that in mind :) Yes Thanks, Kirill
(In reply to comment #4) > On Mon, May 03, 2010 at 07:45:20PM -0000, dfranke at gcc dot gnu dot org wrote: > > (In reply to comment #2) > > On Monday 03 May 2010 21:23:26 you wrote: > > > And when I say "it used to work" I don't mean generating dependencies for > > > f90/f95 sources (PR31588 mentions e.g. USE), but only generating > > > dependencies from plain preprocessor. > > > > What you ask for is "just" a subset of PR31588. If that gets fixed, your > > request will be fixed as well. > > > > Feel free to re-open if you believe that it would be worth to fix the subset > > first. > > Yes, it's a subset of PR31588. > > But as you wrote PR31588 is going to be (maybe) fixed for 4.6, while I > believe regressions in general and this one in particular should be > better handled with higher priority and fixes should go to maintanance > branches. What you apparently fail to understand is that gfortran is written and maintained by a small group of volunteers. If none of these volunteers use this feature and if none of volunteers have the time to work on it, it won't get fixed anytime soon. So, if this is so dear to your heart, pull up your sleeves and start trying to fix the problem. In the meantime, just call cpp directly. troutmask:sgk[214] ~/work/4x/bin/cpp -Wp,-MD,test.d test.F | sed s/#/\!/ ! 1 "test.F" ! 1 "<built-in>" ! 1 "<command-line>" ! 1 "test.F" ! 1 "test.h" 1 ! 2 "test.F" 2 program test print *,'Hello World!' print *,'Hello up there qqq!' end troutmask:sgk[215] cat test.d test.o: test.F test.h
> So, if this is so dear to your heart, pull up your sleeves and start trying > to fix the problem. I see. And thanks for the workaround.
Subject: Bug 43954 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
Makefile dependency generation is now available in trunk (-cpp -MD). See PR44526 for a follow-up request to libcpp. Closing.
REOPEN Daniel, thanks for working on this. Because dropping support for -MD was initially spot as 4.3 -> 4.4 regression, and you committed the fix to 4.6 only, I think it would be good to apply your patch to 4.4 and 4.5 branches as well. I've backported it on top of today's gcc-4_4-branch and gcc-4_5-branch. Tested on i686-pc-linux-gnu OK for 4.4 and "OK for check-fortran" for 4.5 (*). Two patches for 4.4 & 4.5 will be next attached. Please apply and thanks, Kirill (*) as of today, gcc-4_5-branch does not pass all tests on i686-pc-linux-gnu. Look e.g. here http://gcc.gnu.org/ml/gcc-testresults/2010-06/
Created attachment 21031 [details] gfortran-4.4-MD.patch
Created attachment 21032 [details] gfortran-4.5-MD.patch
Could someone please suggest me what I'm maybe doing wrong? Because I posted backported patches twice (first time on the mailing list) and there is always silence on gcc side... And as it is now, -4.4 and -4.5 are left in regressed state compared to -4.3, and the fix is only applied to -4.6 . Thanks, Kirill P.S. and as to the workaround described in comment5 - it does not fully qualify, becase for example calling cpp directly does not define predefined __GFORTRAN__, and I'm sure there are other corner-case when cpp'ing by hand differs from preprocessing from-under gfortran.
(In reply to comment #12) > Could someone please suggest me what I'm maybe doing wrong? Nothing wrong. Just ping the patch from time to time ;-). I've set the target milestone to 4.3.6, so that it may get more attention.
Subject: Re: [4.3/4.4 regression] gfortran does not support -Wp, -MD for *.F On Sat, Aug 07, 2010 at 11:25:26AM -0000, mikael at gcc dot gnu dot org wrote: > ------- Comment #13 from mikael at gcc dot gnu dot org 2010-08-07 11:25 ------- > (In reply to comment #12) > > Could someone please suggest me what I'm maybe doing wrong? > Nothing wrong. Just ping the patch from time to time ;-). I see, thanks. > I've set the target milestone to 4.3.6, so that it may get more attention. Thanks again. But why 4.3? It's 4.4 and 4.5 which need fixing. 4.3 is ok. Am I misunderstanding something? Thanks, Kirill
I have the patch for backport to 4.5 applied to my local 4.5 branch and I am regression testing now.
Subject: Bug 43954 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
(In reply to comment #14) > Thanks again. But why 4.3? It's 4.4 and 4.5 which need fixing. 4.3 is > ok. Am I misunderstanding something? Sorry, my mistake. Changed accordingly (and according to the fix committed by Jerry).
Subject: Re: [4.3/4.4 regression] gfortran does not support -Wp, -MD for *.F On Sat, Aug 07, 2010 at 04:52:14PM -0000, jvdelisle at gcc dot gnu dot org wrote: > ------- Comment #16 from jvdelisle at gcc dot gnu dot org 2010-08-07 16:52 ------- > Subject: Bug 43954 > > 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: ... Thanks a lot! Only if you could please also apply the -4.4 version. *Please* The rationale for this is that 4.4 will be the default compiler in the next upcoming Debian stable. Thanks, Kirill
Subject: Re: [4.4 regression] gfortran does not support -Wp, -MD for *.F > Thanks a lot! > > Only if you could please also apply the -4.4 version. *Please* > > The rationale for this is that 4.4 will be the default compiler in the > next upcoming Debian stable. Will do.
Subject: Bug 43954 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
Closing
Thanks!
*** Bug 260998 has been marked as a duplicate of this bug. *** Seen from the domain http://volichat.com Page where seen: http://volichat.com/adult-chat-rooms Marked for reference. Resolved as fixed @bugzilla.