This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31472] gfortran does not detect the illegal use of an access specification in a program, subroutine, or function
- 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: 4 Apr 2007 17:47:11 -0000
- Subject: [Bug fortran/31472] gfortran does not detect the illegal use of an access specification in a program, subroutine, or function
- References: <bug-31472-14284@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 2007-04-04 18:47 -------
Accepted. Thanks for the report.
We do check for this but only for the PRIVATE/PUBLIC attribute and not for the
PUBLIC/PRIVATE statement.
Patch:
Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c (Revision 123494)
+++ gcc/fortran/decl.c (Arbeitskopie)
@@ -3916,6 +3916,13 @@
if (gfc_match ("private") != MATCH_YES)
return MATCH_NO;
+ if (gfc_current_state () != COMP_MODULE)
+ {
+ gfc_error ("PRIVATE statement at %C is not allowed outside of "
+ "a module");
+ return MATCH_ERROR;
+ }
+
if (gfc_current_state () == COMP_DERIVED)
{
if (gfc_match_eos () == MATCH_YES)
@@ -3946,6 +3953,13 @@
if (gfc_match ("public") != MATCH_YES)
return MATCH_NO;
+ if (gfc_current_state () != COMP_MODULE)
+ {
+ gfc_error ("PUBLIC statement at %C is not allowed outside of "
+ "a module");
+ return MATCH_ERROR;
+ }
+
if (gfc_match_eos () == MATCH_YES)
{
*st = ST_PUBLIC;
--
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|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Keywords| |accepts-invalid
Last reconfirmed|0000-00-00 00:00:00 |2007-04-04 18:47:11
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31472