https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97031
--- Comment #5 from jean-pierre.flam...@univ-lille.fr --- I am sorry to bother you once again, for the last time. I have now understood all things that happened while compiling the very complicated (!) program below. ======================== program tstmak implicit none ! a comment with /* integer :: i ! #ifdef _MYDEBUG_ print *,' debug printing' #endif i = 25 print *,'normal printing: i=',i end program tstmak ======================================== I compiled this fortran with and without -cpp, and always with -D_MYDEBUG_ in a command like that one gfortran -v -ffree-form -Wall -msse2 -g -fbounds-check -fbacktrace -D_MYDEBUG_ -cpp tstmak1.f -o v1 1) if -cpp is PRESENT a) the '/*' in the comment line causes a great problem (in that case an "end of file") and no executable is produced b) if I change the '/*' to anything else, no message, the executable is produced, and prints what is expected 2) if -cpp is ABSENT a) the '/*' in the comment line has no catastrophic effect, but a WARNING appears "Warning: tstmak.f:6: Illegal preprocessor directive" however the executable is produced, and prints what is expected It is because of this warning (and not an error) that I always put "-cpp" in my makefiles ! ===> conclusion: gfortran "tolerates" and understands "#" type directives. This is in opposition to other compilers, which also caused my trouble Sorry for the disturbance JP Flament ----- Mail original ----- De: "kargl at gcc dot gnu.org" <gcc-bugzi...@gcc.gnu.org> À: "jean-pierre flament" <jean-pierre.flam...@univ-lille.fr> Envoyé: Dimanche 13 Septembre 2020 11:55:28 Objet: [Bug fortran/97031] the content of a comment line breaks compilation https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97031 --- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Sun, Sep 13, 2020 at 08:02:01AM +0000, jean-pierre.flam...@univ-lille.fr wrote: > > I just noticed that cpp recognizes the extensions .fpp .F and other uppercase > extensions. > This is why I added -cpp in the gfortran command (otherwise I have a > diagnostic > because of #ifdef's > > I have renamed my file with the .fpp extension; with "-cpp" in the gfortran > submission I get the same errors. > > If I compile the file with extension *.f or .fpp without -cpp > > 1) the compilation has no error > 2) a #ifdef...#endif is recognized even with a .f extension, without -cpp, in > my simple example, (I should check that the directive really is taken into > account !) > 3) IF I compile my full project in a makefile, the absence of "-cpp" in the > gfortran command induces > a "Illegal preprocessor directive" error in all the routines having that > #ifdef...#endif > I don't quite follow you. But, it come down to gfortran uses the C pre-processor when asked to pre-process a file. If you have a C language construct such as '/*' in your Fortran code it will cause problems.