From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Raul Laasner Newsgroups: gmane.emacs.bugs Subject: bug#19809: 24.4; f90-beginning-of-subprogram wrong behavior with string continuation Date: Wed, 11 Feb 2015 11:53:18 +0200 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1140fa98129c68050eccf947 X-Trace: ger.gmane.org 1423648461 29859 80.91.229.3 (11 Feb 2015 09:54:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 11 Feb 2015 09:54:21 +0000 (UTC) Cc: 19809@debbugs.gnu.org To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 11 10:54:13 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YLTzm-0005s5-Hi for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 Feb 2015 10:54:10 +0100 Original-Received: from localhost ([::1]:43851 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLTzl-0007Os-T6 for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 Feb 2015 04:54:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLTzh-0007O3-Ky for bug-gnu-emacs@gnu.org; Wed, 11 Feb 2015 04:54:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLTze-0004Cu-72 for bug-gnu-emacs@gnu.org; Wed, 11 Feb 2015 04:54:05 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48546) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLTze-0004Ck-3Z for bug-gnu-emacs@gnu.org; Wed, 11 Feb 2015 04:54:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YLTzd-0007Xa-KP for bug-gnu-emacs@gnu.org; Wed, 11 Feb 2015 04:54:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Raul Laasner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 11 Feb 2015 09:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19809 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19809-submit@debbugs.gnu.org id=B19809.142364840728944 (code B ref 19809); Wed, 11 Feb 2015 09:54:01 +0000 Original-Received: (at 19809) by debbugs.gnu.org; 11 Feb 2015 09:53:27 +0000 Original-Received: from localhost ([127.0.0.1]:39786 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YLTz4-0007Wl-EU for submit@debbugs.gnu.org; Wed, 11 Feb 2015 04:53:26 -0500 Original-Received: from mail-ig0-f176.google.com ([209.85.213.176]:52417) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YLTz2-0007WY-6M for 19809@debbugs.gnu.org; Wed, 11 Feb 2015 04:53:24 -0500 Original-Received: by mail-ig0-f176.google.com with SMTP id hl2so29607974igb.3 for <19809@debbugs.gnu.org>; Wed, 11 Feb 2015 01:53:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=iDYn5EETtZAqQ2+9q9ptXsRT4QbRE0+vNn82gTqo0lM=; b=OVAhf5jCoJVmq7jNw4ivihXOrEegMc6PPEpCE0GxsujmrDvji6RAbdKOvkg0nQpcLK KUbwimOyq5dwPxyfG8HaiUc78R8KANDdq9ZXfehQPwy92R7OIpSPfPbUAMQPJSJoO6yg 5UeYFPnTUC5narR9bz+KAO4TSL6dDuuaQREQwaI6LMi6nMD8P0tN/np4cm8W1Il3U9jH GdUaUcm4yx9Z37ZoQwgCoMZlAIog5lIrzUtqGCSAQbQF+pDih3BmNu+7sWRnUw45XtIh n7QZM1z2vcPm4KLDT34JJ/lL5ET/IXVdchckMGE1CMc/fMiSO6AqeTNC3Qzh8CXcWGK1 aPzw== X-Received: by 10.107.152.209 with SMTP id a200mr19031919ioe.14.1423648398414; Wed, 11 Feb 2015 01:53:18 -0800 (PST) Original-Received: by 10.36.7.205 with HTTP; Wed, 11 Feb 2015 01:53:18 -0800 (PST) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:99251 Archived-At: --001a1140fa98129c68050eccf947 Content-Type: text/plain; charset=UTF-8 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 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@gmail.com --001a1140fa98129c68050eccf947 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I don't think the standard require= s the second '&', although it is recommended. Moreover, GFortra= n 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 p= roblems because in principle one could also have

=C2=A0 subroutine f= oo
=C2=A0 =C2=A0 ! &
=C2=A0 end subroutine foo

or something as weird as

=C2=A0 subroutine foo
=C2=A0 =C2=A0 ; &= amp;
=C2=A0 end subroutine foo

and it's probably not wo= rth 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 sub= program ends with a bare 'end' not followed by a keyword, also allo= wed by the standard.)


On Wed, Feb 11, 2015 at 3:27 A= M, Glenn Morris <rgm@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<= br> > correct keywords but in fact belong to a continued string. For instanc= e, in
> the following,
>
> subroutine foo()
>=C2=A0 =C2=A0print*, '&
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 end subroutine foo'
>=C2=A0 =C2=A0! 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:

=C2=A0 =C2=A0 Warning: Missing '&' in continued character const= ant at (1)

Ie, you must write

=C2=A0 =C2=A0subroutine foo()
=C2=A0 =C2=A0 =C2=A0print*, '&
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &end subroutine foo'
=C2=A0 =C2=A0end 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@gmail.com
--001a1140fa98129c68050eccf947--