[Bug fortran/50556] cannot save namelist group name

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Oct 28 05:22:00 GMT 2011


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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org 2011-10-28 05:21:48 UTC ---
The patch at the end of this note will issue an error for the test code.
I, however, cannot find any text concerning namelist in the F2008 standard
that prohibits the code.  One might argue that a "SAVE namelist-group-name"
should mean that all namelist-group-objects associate this 
namelist-group-name gets the SAVE attribute.  If this interpretation
was correct, then one would expect that text in the Standard would 
make this clear.


laptop:kargl[231] gfc4x -c foo.f90
foo.f90:2.12:

      save i
            1
Error: Namelist group name at (1) cannot appear in a SAVE statement


Index: decl.c
===================================================================
--- decl.c      (revision 180567)
+++ decl.c      (working copy)
@@ -6831,6 +6831,14 @@ gfc_match_save (void)
          if (gfc_add_save (&sym->attr, SAVE_EXPLICIT, sym->name,
                            &gfc_current_locus) == FAILURE)
            return MATCH_ERROR;
+
+         if (sym->attr.flavor == FL_NAMELIST)
+           {
+             gfc_error ("Namelist group name at %C cannot appear in a "
+                        "SAVE statement");
+             return MATCH_ERROR;
+           }
+
          goto next_item;

        case MATCH_NO:
l



More information about the Gcc-bugs mailing list