This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/30107] improve diagnostic of RECURSIVE LOGICAL SUBROUTINE
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Dec 2006 14:21:10 -0000
- Subject: [Bug fortran/30107] improve diagnostic of RECURSIVE LOGICAL SUBROUTINE
- References: <bug-30107-13648@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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