On Tue, Nov 13, 2018 at 10:06:39AM +0000, Mark Eggleston wrote:
> I've applied this patch and tried it out.
> 
> The following fail to compile:

That is IMHO correct, it fails to compile with ifort as well:
https://fortran.godbolt.org/z/Aav6dv

The problem is in mixing quotes, " vs. '
If I fix that, it works (changed the testcases to use the include file
I had in the patch):

! { dg-do compile }
! { dg-options "-fdec" }
subroutine quux
  implicit none
  include &
  &'include_10.inc'
  i = 1
end subroutine quux
subroutine quuz
  implicit none
  include &
  &"include_10.inc"
  i = 1
end subroutine quuz

c { dg-do compile }
c { dg-options "-fdec-include" }
      subroutine quuz
      implicit none
      integer include
      include
     +"include_10.inc"
      i = 1
      include
     + = 2
      write (*,*) include
      end subroutine quuz
      subroutine corge
      implicit none
      include
     +'include_10.inc'
      i = 1
      end subroutine corge

both compile.  I can include these snippets into the testcases.

> Is there any particular reason that include line continuation is isolated in
> -fdec-include? Is there a specific restriction regarding include lines in
> the Fortran standard such that continuations in free form and fixed form
> can't be used with include lines?

My reading of the Fortran standard says it is invalid, but I am not a good
Fortran language lawyer, so I'm open to be convinced otherwise.

The two bullets that I think say it are:
"An INCLUDE line is not a Fortran statement."
and
"An INCLUDE line shall appear on a single source line where a statement may 
appear; it shall be
the only nonblank text on this line other than an optional trailing comment. 
Thus, a statement
label is not allowed."

If there are continuations, it is not a single source line anymore, I don't
see anywhere a word that all the continuations together with the initial
source line are considered a single source line for the purposes of the rest
of the standard.

And in the DEC manual, it explicitly says that INCLUDE is a statement and
that it can be continued.

        Jakub

Reply via email to