This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] attribute declaration outside of INTERFACE body (PR36361)
- From: Tobias Burnus <burnus at net-b dot de>
- To: Janus Weil <jaydub66 at googlemail dot com>
- Cc: "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 02 Jun 2008 18:16:03 +0200
- Subject: Re: [Patch, Fortran] attribute declaration outside of INTERFACE body (PR36361)
- References: <854832d40805301619r2ac9d481ke5d7d20afbbbc751@mail.gmail.com>
Janus Weil wrote:
There is just one thing I need someone's opinion on: The new test case
interface_24.f90 has some slight issues regarding error recovery. For
"f2" and "f5" I commented out some lines of (normally valid) code, to
get rid of excess errors:
dimension :: f2(4)
interface
real function f2() ! { dg-error "outside its INTERFACE body" }
!end function
end interface
Otherwise I get an additional error like:
end function
1
Error: Expecting END INTERFACE statement at (1)
Is this acceptable for a test case? Or should I rather use additional
dg-errors to catch all of the excess errors? Right now I see no easy
way to completely get rid of these recovery issues.
Commenting the "end function" is OK as is to add another "dg-error
"Expecting END FUNCTION".
I have modified the fix for PR36275 a little, so that it also fixes
PR36322, which is actually related.
Can you add PR36322 to ChangeLog? Additionally, note that for PR36275
only comment 2 is fixed while comment 0 remains unfixed. (Please add a
note there after check in.)
+ if (source == IFSRC_IFBODY && (sym->attr.dimension || sym->attr.allocatable))
+ {
+ gfc_error ("Attribute declaration for %s outside its INTERFACE body "
I somehow think the following wording is less clearer:
+ if (source == IFSRC_IFBODY && (sym->attr.dimension || sym->attr.allocatable))
+ {
+ gfc_error ("'%s' at %L has attributes specified outside its INTERFACE "
+ "body", sym->name, where);
I also wonder whether one should do:
- gfc_error ("DIMENSION declaration for %s outside its INTERFACE body "
+ gfc_error ("DIMENSION specified for %s outside its INTERFACE body "
and analogously for
+ gfc_error ("ALLOCATABLE delaration outside of INTERFACE body at %L",
I leave it to you whether you change this wording.
Otherwise the patch looks OK. Thanks for the patch.
Tobias
PS: What is the plan for the next patch? Procedure pointers (part 1) or some in-between patch? I believe that http://gcc.gnu.org/ml/fortran/2008-05/msg00301.html was almost ready for check in; some fixes such as COMMON one could do afterwards. (Though I would not be surprised if it turned out to be trivial to support COMMON.)