[Bug fortran/38312] Unexpected STATEMENT FUNCTION statement

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Nov 12 22:41:00 GMT 2011


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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #5 from kargl at gcc dot gnu.org 2011-11-12 22:03:49 UTC ---
I've looked at this issue, and I have come to the conclusion
that it should be closed as WONTFIX.  First, an error is 
issued, so one can fix their Fortran code.

Now, for the problem.  The matchers are called from the 
parser according this diagram (parse.c line 1717).

        +---------------------------------------+
        | program  subroutine  function  module |
        +---------------------------------------+
        |                use                    |
        +---------------------------------------+
        |                import                 |
        +---------------------------------------+
        |         |        implicit none        |
        |         +-----------+-----------------+
        |         | parameter |  implicit       |
        |         +-----------+-----------------+
        | format  |           |  derived type   |
        | entry   | parameter |  interface      |
        |         |   data    |  specification  |
        |         |           |  statement func |
        |         +-----------+-----------------+
        |         |   data    |    executable   |
        +---------+-----------+-----------------+
        |                contains               |
        +---------------------------------------+
        |      internal module/subprogram       |
        +---------------------------------------+
        |                end                    |
        +---------------------------------------+

As one can see, a DATA statement and a statement function are
parsed at the same level.  A programmer can use an implied
do-loop within a DATA statement.  Unfortunately, an implied
do-loop is parsed by the same code that parses a regular
do-loop.  It appears that insufficient information is contained
within the parser at the point where the error is issued
to determine that the do-loop is in an executable portion of
the program.



More information about the Gcc-bugs mailing list