public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jean-pierre.flament@univ-lille.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/97031] the content of a comment line breaks compilation
Date: Mon, 14 Sep 2020 07:05:28 +0000	[thread overview]
Message-ID: <bug-97031-4-JWLSSo4xqe@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97031-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from jean-pierre.flament@univ-lille.fr ---
see below:

----- Mail original -----
De: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
À: "jean-pierre flament" <jean-pierre.flament@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.flament@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.

====> In my remarks just above  2) and 3) I just wanted to point that,
apprently, in addtion, gfortran+cpp seem to have a different behaviour when
called in a makefile or in a simple command line. I can check that more.

===>  as regards the intial point: do you find it normal that, processing a
fortran file (and I imagine that CPP knows that point since it was launched 
within the gfortran command) CPP does not consider fortran comment lines as
such, and ignores their content.
    In addition I noticed that there is a '*/' construct farther in the file in
an other commented line (line = "... */ ...", and that thus all the stuff
inbetween was ignored, suppresing all the declarations  (character and others)
ans some other statements; this explains the diagnostics of the compiler.
     another questions raises:  the '*/' was within " ", i.e. a character
string... a legal fortran statement.
     before commenting this line I had an other message reporting an end for
file before the end of a comment (I don't remember exactly
     the formulation). That's why I  finally decided to create the test file
that you have, commenting all the lines with call's and the famous  line =
"...." . I know understand what happened. 

  but once again: cpp does not seem  to understand the syntax of fortran ! 
this is very annoying !

  parent reply	other threads:[~2020-09-14  7:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-12  8:20 [Bug fortran/97031] New: " jean-pierre.flament@univ-lille.fr
2020-09-12 16:14 ` [Bug fortran/97031] " kargl at gcc dot gnu.org
2020-09-13  8:02 ` jean-pierre.flament@univ-lille.fr
2020-09-13 15:55 ` sgk at troutmask dot apl.washington.edu
2020-09-14  7:05 ` jean-pierre.flament@univ-lille.fr [this message]
2020-09-14  8:09 ` jean-pierre.flament@univ-lille.fr
2020-10-05 12:28 ` dominiq at lps dot ens.fr
2021-01-25 19:11 ` tkoenig at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-97031-4-JWLSSo4xqe@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).