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/31472] gfortran does not detect the illegal use of an access specification in a program, subroutine, or function



------- 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


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