]> gcc.gnu.org Git - gcc.git/commitdiff
re PR fortran/88299 ([F18] COMMON in a legacy module produces bogus warnings in depen...
authorHarald Anlauf <anlauf@gmx.de>
Sun, 17 Feb 2019 21:19:20 +0000 (21:19 +0000)
committerHarald Anlauf <anlauf@gcc.gnu.org>
Sun, 17 Feb 2019 21:19:20 +0000 (21:19 +0000)
2019-02-17  Harald Anlauf  <anlauf@gmx.de>

PR fortran/88299
* resolve.c (resolve_common_blocks,resolve_common_vars): Move
check for obsolent COMMON feature in F2018 to better place.

PR fortran/88299
* gfortran.dg/pr88299.f90: New test.

From-SVN: r268974

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr88299.f90 [new file with mode: 0644]

index aa474a44160c7c6f11a9a4ebb89d369e9f95a399..4f150e257eb529e9f60dcdd68006eb2bdcb423f7 100644 (file)
@@ -1,3 +1,9 @@
+2019-02-17  Harald Anlauf  <anlauf@gmx.de>
+
+       PR fortran/88299
+       * resolve.c (resolve_common_blocks,resolve_common_vars): Move
+       check for obsolent COMMON feature in F2018 to better place.
+
 2019-02-17  Harald Anlauf  <anlauf@gmx.de>
 
        PR fortran/89077
index e215fef2be5a5f9dd256468a37267355466f5081..e581a60f157f41f1ea88764a56ab8b62b2ec9b8f 100644 (file)
@@ -940,7 +940,11 @@ resolve_common_vars (gfc_common_head *common_block, bool named_common)
         have been ignored to continue parsing.
         We do the checks again here.  */
       if (!csym->attr.use_assoc)
-       gfc_add_in_common (&csym->attr, csym->name, &common_block->where);
+       {
+         gfc_add_in_common (&csym->attr, csym->name, &common_block->where);
+         gfc_notify_std (GFC_STD_F2018_OBS, "COMMON block at %L",
+                         &common_block->where);
+       }
 
       if (csym->value || csym->attr.data)
        {
@@ -998,10 +1002,6 @@ resolve_common_blocks (gfc_symtree *common_root)
 
   resolve_common_vars (common_root->n.common, true);
 
-  if (!gfc_notify_std (GFC_STD_F2018_OBS, "COMMON block at %L",
-                      &common_root->n.common->where))
-    return;
-
   /* The common name is a global name - in Fortran 2003 also if it has a
      C binding name, since Fortran 2008 only the C binding name is a global
      identifier.  */
index 6b2ffa3f02249a50f62f8b4c49dd0d181c2afa08..9b197cc7947e92f22641b1ccae5b7f80d7490f28 100644 (file)
@@ -1,3 +1,8 @@
+2019-02-17  Harald Anlauf  <anlauf@gmx.de>
+
+       PR fortran/88299
+       * gfortran.dg/pr88299.f90: New test.
+
 2019-02-17  Harald Anlauf  <anlauf@gmx.de>
 
        PR fortran/89077
diff --git a/gcc/testsuite/gfortran.dg/pr88299.f90 b/gcc/testsuite/gfortran.dg/pr88299.f90
new file mode 100644 (file)
index 0000000..5471d40
--- /dev/null
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! { dg-options "-std=f2018" }
+!
+! PR 85839: [F18] COMMON in a legacy module produces bogus warnings
+!           in dependent code
+
+module legacy
+  integer :: major, n
+  common /version/ major  ! { dg-warning "obsolescent feature" }
+  public  :: n
+  private
+end module legacy
+
+module mod1
+  use legacy, only: n     ! No warning expected here
+end module mod1
This page took 0.106843 seconds and 5 git commands to generate.