public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34763]  New: bare END not allowed in an interface block in a module procedure
@ 2008-01-12 21:24 dick dot hendrickson at gmail dot com
  2008-01-12 22:04 ` [Bug fortran/34763] " burnus at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dick dot hendrickson at gmail dot com @ 2008-01-12 21:24 UTC (permalink / raw)
  To: gcc-bugs

With gfortran 4.3.0 20080109 I get the error message

n_interface.f:7.12:

            END
           1
Error: END SUBROUTINE statement expected at (1)

with the following program
      module n
      contains
      subroutine n_interface
      INTERFACE
            SUBROUTINE NGSXDY(TLS1,TLS2)
            REAL  ::  TLS1,TLS2
            END                 
      END INTERFACE
      end
      end module

If the n_interface is an external procedure it works fine.  A bare
END statement is allowed in interface blocks.  I'd guess you
are misapplying the constraint after R1224 to things inside of
interface blocks.  But NGSXDY isn't a module subroutine.  You'll
probably need a similar fix for functions in interface blocks,
although I haven't tried that.

Dick Hendrickson


-- 
           Summary: bare END not allowed in an interface block in a module
                    procedure
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dick dot hendrickson at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34763


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

* [Bug fortran/34763] bare END not allowed in an interface block in a module procedure
  2008-01-12 21:24 [Bug fortran/34763] New: bare END not allowed in an interface block in a module procedure dick dot hendrickson at gmail dot com
@ 2008-01-12 22:04 ` burnus at gcc dot gnu dot org
  2008-01-12 22:46 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-12 22:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2008-01-12 21:23 -------
Confirm. (Though you missed "subroutine" for "end subroutine n_interface" in
your example.)

The Fortran 2003 references are:
  C1243 (R1230) FUNCTION shall appear in the end-function-stmt of an internal
                or module function.
and
  C1248 (R1234) SUBROUTINE shall appear in the end-subroutine-stmt of an
                internal or module subroutine.

Seemingly, the contained_procedure() check in decl.c, called by gfc_match_end,
does not work properly.

Thanks for report.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |32834
              nThis|                            |
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2008-01-12 21:23:52
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34763


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

* [Bug fortran/34763] bare END not allowed in an interface block in a module procedure
  2008-01-12 21:24 [Bug fortran/34763] New: bare END not allowed in an interface block in a module procedure dick dot hendrickson at gmail dot com
  2008-01-12 22:04 ` [Bug fortran/34763] " burnus at gcc dot gnu dot org
@ 2008-01-12 22:46 ` burnus at gcc dot gnu dot org
  2008-01-13 18:00 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-12 22:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2008-01-12 22:35 -------
I believe the following patch is correct.

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c  (revision 131492)
+++ gcc/fortran/decl.c  (working copy)
@@ -4870,12 +4870,11 @@ gfc_match_bind_c (gfc_symbol *sym, bool
 static int
 contained_procedure (void)
 {
-  gfc_state_data *s;
+  gfc_state_data *s = gfc_state_stack;

-  for (s=gfc_state_stack; s; s=s->previous)
-    if ((s->state == COMP_SUBROUTINE || s->state == COMP_FUNCTION)
-       && s->previous != NULL && s->previous->state == COMP_CONTAINS)
-      return 1;
+  if ((s->state == COMP_SUBROUTINE || s->state == COMP_FUNCTION)
+      && s->previous != NULL && s->previous->state == COMP_CONTAINS)
+    return 1;

   return 0;
 }


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |burnus at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-01-12 21:23:52         |2008-01-12 22:35:19
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34763


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

* [Bug fortran/34763] bare END not allowed in an interface block in a module procedure
  2008-01-12 21:24 [Bug fortran/34763] New: bare END not allowed in an interface block in a module procedure dick dot hendrickson at gmail dot com
  2008-01-12 22:04 ` [Bug fortran/34763] " burnus at gcc dot gnu dot org
  2008-01-12 22:46 ` burnus at gcc dot gnu dot org
@ 2008-01-13 18:00 ` burnus at gcc dot gnu dot org
  2008-01-13 21:50 ` burnus at gcc dot gnu dot org
  2008-01-13 22:15 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-13 18:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2008-01-13 17:41 -------
Patch: http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00567.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34763


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

* [Bug fortran/34763] bare END not allowed in an interface block in a module procedure
  2008-01-12 21:24 [Bug fortran/34763] New: bare END not allowed in an interface block in a module procedure dick dot hendrickson at gmail dot com
                   ` (2 preceding siblings ...)
  2008-01-13 18:00 ` burnus at gcc dot gnu dot org
@ 2008-01-13 21:50 ` burnus at gcc dot gnu dot org
  2008-01-13 22:15 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-13 21:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2008-01-13 21:30 -------
Subject: Bug 34763

Author: burnus
Date: Sun Jan 13 21:29:49 2008
New Revision: 131512

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131512
Log:
2008-01-13  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34763
        * decl.c (contained_procedure): Only check directly preceeding
        * state.

2008-01-13  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34763
        * gfortran.dg/interface_proc_end.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/interface_proc_end.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34763


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

* [Bug fortran/34763] bare END not allowed in an interface block in a module procedure
  2008-01-12 21:24 [Bug fortran/34763] New: bare END not allowed in an interface block in a module procedure dick dot hendrickson at gmail dot com
                   ` (3 preceding siblings ...)
  2008-01-13 21:50 ` burnus at gcc dot gnu dot org
@ 2008-01-13 22:15 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-13 22:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2008-01-13 21:49 -------
Fixed on the trunk (4.3.0).

Thanks for the report!


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34763


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

end of thread, other threads:[~2008-01-13 21:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-12 21:24 [Bug fortran/34763] New: bare END not allowed in an interface block in a module procedure dick dot hendrickson at gmail dot com
2008-01-12 22:04 ` [Bug fortran/34763] " burnus at gcc dot gnu dot org
2008-01-12 22:46 ` burnus at gcc dot gnu dot org
2008-01-13 18:00 ` burnus at gcc dot gnu dot org
2008-01-13 21:50 ` burnus at gcc dot gnu dot org
2008-01-13 22:15 ` burnus at gcc dot gnu dot org

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