]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2019-06-19 Steven G. Kargl <kargl@gcc.gnu.org>
authorkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 19 Jun 2019 18:18:40 +0000 (18:18 +0000)
committerkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 19 Jun 2019 18:18:40 +0000 (18:18 +0000)
PR fortran/69499
* match.c (gfc_match_select_type):  SELECT TYPE is an executable
statement, and cannot appear in MODULE or SUBMODULE scope.

2019-06-19  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/69499
* gfortran.dg/pr69499.f90: New test.
* gfortran.dg/module_error_1.f90: Update dg-error string.

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

gcc/fortran/ChangeLog
gcc/fortran/match.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/module_error_1.f90
gcc/testsuite/gfortran.dg/pr69499.f90 [new file with mode: 0644]

index 2014342f9dacae4ae667cda636e304149481ecc3..bf54e29271b3833f4c9b147bf7027897f7778247 100644 (file)
@@ -1,3 +1,9 @@
+2019-06-19  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/69499
+       * match.c (gfc_match_select_type):  SELECT TYPE is an executable 
+       statement, and cannot appear in MODULE or SUBMODULE scope.
+
 2019-06-19  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/69398
index 69698e5ba2ecec701037fb7eb7425a37c656a5ba..1c08da7f43f59262b2485427be2717f620076f36 100644 (file)
@@ -6219,6 +6219,13 @@ gfc_match_select_type (void)
   if (m != MATCH_YES)
     return m;
 
+  if (gfc_current_state() == COMP_MODULE
+      || gfc_current_state() == COMP_SUBMODULE)
+    {
+      gfc_error ("SELECT TYPE at %C cannot appear in this scope");
+      return MATCH_ERROR;
+    }
+
   gfc_current_ns = gfc_build_block_ns (ns);
   m = gfc_match (" %n => %e", name, &expr2);
   if (m == MATCH_YES)
index 5b81695aa248666ef68907aadb84f8688a7d5a3a..bb2e848a74371c98dcea7aaa910a23d0805280b9 100644 (file)
@@ -1,3 +1,9 @@
+2019-06-19  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/69499
+       * gfortran.dg/pr69499.f90: New test.
+       * gfortran.dg/module_error_1.f90: Update dg-error string.
+
 2019-06-19  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/69398
index 84decc0a5710e1d9acafaf7c71f36f24e4fd92b7..1792be6e9faf937b03c70621be427c489a0e8169 100644 (file)
@@ -1,5 +1,5 @@
 ! { dg-do compile }
 ! PR fortran/50627
 module kernels
-      select type (args) ! { dg-error "Unexpected SELECT TYPE" }
+      select type (args) ! { dg-error "cannot appear in this scope" }
 end module kernels
diff --git a/gcc/testsuite/gfortran.dg/pr69499.f90 b/gcc/testsuite/gfortran.dg/pr69499.f90
new file mode 100644 (file)
index 0000000..169c6ce
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR fortran/69499
+! Contributed by Gerhard Steinmetz.
+module m
+   class(*) :: z        ! { dg-error "must be dummy, allocatable or pointer" }
+   select type (x => z) ! { dg-error "cannot appear in this scope" }
+end