This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/30107] improve diagnostic of RECURSIVE LOGICAL SUBROUTINE



------- Comment #1 from burnus at gcc dot gnu dot org  2006-12-07 14:21 -------
While I agree that the message is not that helpful, other compilers don't do
much better. (The problem is: There are zillions of ways to write invalid
code.)

I'd favour a WONTFIX, but maybe someone has a good idea and is bored ...


Besides, the question is how should the error message look like? I don't like
the following messages better:

NAG f95:
Error: af.f90, line 1: syntax error
       detected at LOGICAL@SUBROUTINE
***Malformed statement


g95 / gfortran:
RECURSIVE LOGICAL SUBROUTINE foo()
1
Error: Unclassifiable statement at (1)
In file af.f90:2
END SUBROUTINE
   1
Error: Expecting END PROGRAM statement at (1)


ifort:
fortcom: Error: af.f90, line 1: Syntax error, found IDENTIFIER 'SUBROUTINE'
when expecting one of: TYPE COMPLEX BYTE CHARACTER DOUBLE DOUBLECOMPLEX
DOUBLEPRECISION INTEGER LOGICAL ...
RECURSIVE LOGICAL SUBROUTINE foo()
------------------^
fortcom: Error: af.f90, line 2: This is an invalid statement; an END [FUNCTION]
statement is required.
END SUBROUTINE
^
fortcom: Warning: af.f90, line 1: The return value of this FUNCTION has not
been defined.   [FOO]
RECURSIVE LOGICAL SUBROUTINE foo()
-----------------------------^
compilation aborted for af.f90 (code 1)


sunf95:
RECURSIVE LOGICAL SUBROUTINE foo()
                  ^
"af.f90", Line = 1, Column = 19: ERROR: Unexpected syntax: "[ELEMENTAL] [PURE]
FUNCTION" was expected but found "S".
END SUBROUTINE
^
"af.f90", Line = 2, Column = 1: ERROR: This END SUBROUTINE statement has no
matching SUBROUTINE statement.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]