OSDN Git Service

2012-01-21 Tobias Burnus <burnus@net-b.de>
authorkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 21 Jan 2012 17:32:12 +0000 (17:32 +0000)
committerkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 21 Jan 2012 17:32:12 +0000 (17:32 +0000)
    Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/50556
* symbol.c (check_conflict): namelist-group-name cannot have the SAVE
attribure.

2012-01-21  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/50556
* gfortran.dg/namelist_74.f90: New test.
* gfortran.dg/namelist_59.f90: Remove SAVE attribute.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183370 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/symbol.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/namelist_59.f90
gcc/testsuite/gfortran.dg/namelist_74.f90 [new file with mode: 0644]

index bff42e5..85aaa21 100644 (file)
@@ -1,4 +1,11 @@
 2012-01-21  Tobias Burnus  <burnus@net-b.de>
+           Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/50556
+       * symbol.c (check_conflict): namelist-group-name cannot have the SAVE
+       attribure.
+
+2012-01-21  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/51913
        * interface.c (compare_parameter): Fix CLASS comparison.
index fcc1ccf..36fc1ed 100644 (file)
@@ -444,12 +444,15 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
             a1 = gfc_code2string (flavors, attr->flavor);
             a2 = save;
            goto conflict;
-
+         case FL_NAMELIST:
+           gfc_error ("Namelist group name at %L cannot have the "
+                      "SAVE attribute", where);
+           return FAILURE; 
+           break;
          case FL_PROCEDURE:
            /* Conflicts between SAVE and PROCEDURE will be checked at
               resolution stage, see "resolve_fl_procedure".  */
          case FL_VARIABLE:
-         case FL_NAMELIST:
          default:
            break;
        }
index 81597d2..5131389 100644 (file)
@@ -1,3 +1,9 @@
+2012-01-21  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/50556
+       * gfortran.dg/namelist_74.f90: New test.
+       * gfortran.dg/namelist_59.f90: Remove SAVE attribute.
+
 2012-01-21  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/51913
index bb68b9b..f69a49a 100644 (file)
@@ -16,7 +16,6 @@ subroutine process(string)
  integer :: i=1,j=2,k=3
  integer ios
  namelist /cmd/ i,j,k
- save cmd
  lines(1)='&cmd'
  lines(2)=string
  lines(3)='/'
diff --git a/gcc/testsuite/gfortran.dg/namelist_74.f90 b/gcc/testsuite/gfortran.dg/namelist_74.f90
new file mode 100644 (file)
index 0000000..520c7ab
--- /dev/null
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! PR fortran/50556
+subroutine foo
+   save i
+   namelist /i/ ii    ! { dg-error "cannot have the SAVE attribute" }
+end subroutine foo
+subroutine bar
+   namelist /i/ ii
+   save i             ! { dg-error "cannot have the SAVE attribute" }
+end subroutine bar