public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/66058] New: Backslash in comment kills compile
@ 2015-05-07 19:29 matthew.thompson at nasa dot gov
  2015-05-07 19:50 ` [Bug fortran/66058] " kargl at gcc dot gnu.org
  2015-05-08 15:34 ` sgk at troutmask dot apl.washington.edu
  0 siblings, 2 replies; 3+ messages in thread
From: matthew.thompson at nasa dot gov @ 2015-05-07 19:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66058
           Summary: Backslash in comment kills compile
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: matthew.thompson at nasa dot gov
  Target Milestone: ---

Created attachment 35489
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35489&action=edit
Reproducer of compiler bug

I've discovered what I think is a bug in gfortran-5.1.0 but I'm not sure. To
wit, given the code attached, if you compile it:

**********

(430) $ gfortran -c -v -save-temps TRAMP_coag.F
Using built-in specs.
COLLECT_GCC=gfortran
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-5.1.0/configure --prefix=/ford1/local/gcc/gcc-5.1.0
Thread model: posix
gcc version 5.1.0 (GCC) 
COLLECT_GCC_OPTIONS='-c' '-v' '-save-temps' '-mtune=generic' '-march=x86-64'
 /ford1/local/gcc/gcc-5.1.0/libexec/gcc/x86_64-unknown-linux-gnu/5.1.0/f951
TRAMP_coag.F -ffixed-form -cpp=TRAMP_coag.f90 -quiet -v TRAMP_coag.F -quiet
-dumpbase TRAMP_coag.F -mtune=generic -march=x86-64 -auxbase TRAMP_coag
-version -fintrinsic-modules-path
/ford1/local/gcc/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/finclude -o
TRAMP_coag.s
GNU Fortran (GCC) version 5.1.0 (x86_64-unknown-linux-gnu)
        compiled by GNU C version 5.1.0, GMP version 4.3.2, MPFR version 2.4.2,
MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/ford1/local/gcc/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /ford1/local/gcc/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/finclude
 /ford1/local/gcc/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/include
 /usr/local/include
 /ford1/local/gcc/gcc-5.1.0/include

/ford1/local/gcc/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/include-fixed
 /usr/include
End of search list.
GNU Fortran2008 (GCC) version 5.1.0 (x86_64-unknown-linux-gnu)
        compiled by GNU C version 5.1.0, GMP version 4.3.2, MPFR version 2.4.2,
MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
TRAMP_coag.F:27:31:

         IF( PUSE .GT. KIJ_PRES2 ) THEN
                               1
Error: Symbol ‘kij_pres2’ at (1) has no IMPLICIT type
TRAMP_coag.F:23:31:

         IF( TUSE .GT. KIJ_TEMP2 ) THEN
                               1
Error: Symbol ‘kij_temp2’ at (1) has no IMPLICIT type

**********

Now, if you open that code and remove the backslashes at the end of lines 5 and
7, you get:

**********

(431) $ gfortran -c -v -save-temps TRAMP_coag.works.F
Using built-in specs.
COLLECT_GCC=gfortran
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-5.1.0/configure --prefix=/ford1/local/gcc/gcc-5.1.0
Thread model: posix
gcc version 5.1.0 (GCC) 
COLLECT_GCC_OPTIONS='-c' '-v' '-save-temps' '-mtune=generic' '-march=x86-64'
 /ford1/local/gcc/gcc-5.1.0/libexec/gcc/x86_64-unknown-linux-gnu/5.1.0/f951
TRAMP_coag.works.F -ffixed-form -cpp=TRAMP_coag.works.f90 -quiet -v
TRAMP_coag.works.F -quiet -dumpbase TRAMP_coag.works.F -mtune=generic
-march=x86-64 -auxbase TRAMP_coag.works -version -fintrinsic-modules-path
/ford1/local/gcc/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/finclude -o
TRAMP_coag.works.s
GNU Fortran (GCC) version 5.1.0 (x86_64-unknown-linux-gnu)
        compiled by GNU C version 5.1.0, GMP version 4.3.2, MPFR version 2.4.2,
MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/ford1/local/gcc/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /ford1/local/gcc/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/finclude
 /ford1/local/gcc/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/include
 /usr/local/include
 /ford1/local/gcc/gcc-5.1.0/include

/ford1/local/gcc/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/include-fixed
 /usr/include
End of search list.
GNU Fortran2008 (GCC) version 5.1.0 (x86_64-unknown-linux-gnu)
        compiled by GNU C version 5.1.0, GMP version 4.3.2, MPFR version 2.4.2,
MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='-c' '-v' '-save-temps' '-mtune=generic' '-march=x86-64'
 as -v --64 -o TRAMP_coag.works.o TRAMP_coag.works.s
GNU assembler version 2.20.51.0.2 (x86_64-redhat-linux) using BFD version
version 2.20.51.0.2-5.42.el6 20100205
COMPILER_PATH=/ford1/local/gcc/gcc-5.1.0/libexec/gcc/x86_64-unknown-linux-gnu/5.1.0/:/ford1/local/gcc/gcc-5.1.0/libexec/gcc/x86_64-unknown-linux-gnu/5.1.0/:/ford1/local/gcc/gcc-5.1.0/libexec/gcc/x86_64-unknown-linux-gnu/:/ford1/local/gcc/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/:/ford1/local/gcc/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/
LIBRARY_PATH=/ford1/local/gcc/gcc-5.1.0/lib64/../lib64/:/ford1/local/gcc/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/:/ford1/local/gcc/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/ford1/local/gcc/gcc-5.1.0/lib64/:/ford1/local/gcc/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-c' '-v' '-save-temps' '-mtune=generic' '-march=x86-64'

**********

I will note that PGI and Intel Fortran compile this just fine.
>From gcc-bugs-return-485786-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu May 07 19:30:05 2015
Return-Path: <gcc-bugs-return-485786-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 79315 invoked by alias); 7 May 2015 19:30:05 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 79209 invoked by uid 48); 7 May 2015 19:30:00 -0000
From: "matthew.thompson at nasa dot gov" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/66058] Backslash in comment kills compile
Date: Thu, 07 May 2015 19:30:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 5.1.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: matthew.thompson at nasa dot gov
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66058-4-WhxvEzX5uE@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66058-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66058-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-05/txt/msg00626.txt.bz2
Content-length: 233

https://gcc.gnu.org/bugzilla/show_bug.cgi?idf058

--- Comment #1 from Matt Thompson <matthew.thompson at nasa dot gov> ---
Addendum,

I've tried various gfortran flags, but for the life of me, none seem to get
this to work.

Matt


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

* [Bug fortran/66058] Backslash in comment kills compile
  2015-05-07 19:29 [Bug fortran/66058] New: Backslash in comment kills compile matthew.thompson at nasa dot gov
@ 2015-05-07 19:50 ` kargl at gcc dot gnu.org
  2015-05-08 15:34 ` sgk at troutmask dot apl.washington.edu
  1 sibling, 0 replies; 3+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-05-07 19:50 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |kargl at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to Matt Thompson from comment #1)
> Addendum,
> 
> I've tried various gfortran flags, but for the life of me, none seem to get
> this to work.
> 
> Matt

You're getting the expected behaviour implied by the .F extention.
The pre-processor is doing what it is should (from n1256.pdf)

    Each instance of a backslash character (\) immediately followed
    by a new-line character is deleted, splicing physical source
    lines to form logical source lines.  Only the last backslash on
    any physical source line shall be eligible for being part of
    such a splice. A source file that is not empty shall end in a
    new-line character, which shall not be immediately preceded
    by a backslash character before any such splicing takes place.

The option that you are looking for is -xf95.  It tells gfortran
to ignore the .F extension and treat the code as Fortran 95 without
doing the pre-processing.


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

* [Bug fortran/66058] Backslash in comment kills compile
  2015-05-07 19:29 [Bug fortran/66058] New: Backslash in comment kills compile matthew.thompson at nasa dot gov
  2015-05-07 19:50 ` [Bug fortran/66058] " kargl at gcc dot gnu.org
@ 2015-05-08 15:34 ` sgk at troutmask dot apl.washington.edu
  1 sibling, 0 replies; 3+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2015-05-08 15:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Fri, May 08, 2015 at 12:31:39PM +0000, matthew.thompson at nasa dot gov
wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66058
> 
> --- Comment #3 from Matt Thompson <matthew.thompson at nasa dot gov> ---
> (In reply to kargl from comment #2)
> > (In reply to Matt Thompson from comment #1)
> > > 
> > > I've tried various gfortran flags, but for the life of me, none seem to get
> > > this to work.
> > 
> > You're getting the expected behaviour implied by the .F extention.
> > The pre-processor is doing what it is should (from n1256.pdf)
> > 
> >     Each instance of a backslash character (\) immediately followed
> >     by a new-line character is deleted, splicing physical source
> >     lines to form logical source lines.  Only the last backslash on
> >     any physical source line shall be eligible for being part of
> >     such a splice. A source file that is not empty shall end in a
> >     new-line character, which shall not be immediately preceded
> >     by a backslash character before any such splicing takes place.
> > 
> > The option that you are looking for is -xf95.  It tells gfortran
> > to ignore the .F extension and treat the code as Fortran 95 without
> > doing the pre-processing.
> 
> Ahh. Okay, thanks. It might be nice to put a reference to -x in the gfortran
> manpage. It always confuses me that some Fortran options are only visible in
> the gcc manpage...
> 

gfortran supports most (all?) of the options that gcc supports.
It was decided to not reproduce the gcc manual within the gfortran
manual.  You'll find in Sec. 2, this statement:

   The 'gfortran' command supports all the options supported by the 'gcc'
   command.  Only options specific to GNU Fortran are documented here.

In looking through Sec. 1.3 that details the .F behaviour, I find

   Many Fortran compilers including GNU Fortran allow passing the source
   code through a C preprocessor (CPP; sometimes also called the Fortran
   preprocessor, FPP) to allow for conditional compilation.  In the case
   of GNU Fortran, this is the GNU C Preprocessor in the traditional mode.
   On systems with case-preserving file names, the preprocessor is
   automatically invoked if the filename extension is '.F', '.FOR', '.FTN',
   '.fpp', '.FPP', '.F90', '.F95', '.F03' or '.F08'.  To manually invoke
   the preprocessor on any file, use '-cpp', to disable preprocessing on
   files where the preprocessor is run automatically, use '-nocpp'.

so the -nocpp option should also work.


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

end of thread, other threads:[~2015-05-08 15:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-07 19:29 [Bug fortran/66058] New: Backslash in comment kills compile matthew.thompson at nasa dot gov
2015-05-07 19:50 ` [Bug fortran/66058] " kargl at gcc dot gnu.org
2015-05-08 15:34 ` sgk at troutmask dot apl.washington.edu

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