GNU bug report logs -
#19809
24.4; f90-beginning-of-subprogram wrong behavior with string continuation
Previous Next
Reported by: Raul Laasner <raullaasner <at> gmail.com>
Date: Sat, 7 Feb 2015 21:01:02 UTC
Severity: minor
Found in version 24.4
Fixed in version 25.1
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
I don't think the standard requires the second '&', although it is
recommended. Moreover, GFortran permits its omission and so in practice
people sometimes write such code. In any case, I have realized that the
proposed modification leads to new problems because in principle one could
also have
subroutine foo
! &
end subroutine foo
or something as weird as
subroutine foo
; &
end subroutine foo
and it's probably not worth the effort to account for such unlikely cases.
If the function is used mainly interactively then it's immediately clear
anyway if it fails due to unusual coding style. (On a different subject, it
also fails if the subprogram ends with a bare 'end' not followed by a
keyword, also allowed by the standard.)
On Wed, Feb 11, 2015 at 3:27 AM, Glenn Morris <rgm <at> gnu.org> wrote:
> Raul Laasner wrote:
>
> > The functions f90-beginning-of-subprogram and f90-end-of-subprogram do
> not
> > work correctly if the source file contains lines which begin with the
> > correct keywords but in fact belong to a continued string. For instance,
> in
> > the following,
> >
> > subroutine foo()
> > print*, '&
> > end subroutine foo'
> > ! The cursor is here
> > end subroutine foo
>
> But that's not valid Fortran? Continued strings must use '&' at the
> start of the continued lines as well? Eg gfortran 4.8.2 says:
>
> Warning: Missing '&' in continued character constant at (1)
>
> Ie, you must write
>
> subroutine foo()
> print*, '&
> &end subroutine foo'
> end subroutine foo
>
> in which case there isn't a problem.
>
--
Raul Laasner
Institute of Physics
University of Tartu
Ravila 14c, 50411, Estonia
e-mail: raullaasner <at> gmail.com
[Message part 2 (text/html, inline)]
This bug report was last modified 10 years and 94 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.