Revert "Fortran : ICE in build_field PR95614"
authorMark Eggleston <markeggleston@gcc.gnu.org>
Mon, 28 Sep 2020 10:01:40 +0000 (11:01 +0100)
committerMark Eggleston <markeggleston@gcc.gnu.org>
Mon, 28 Sep 2020 10:02:58 +0000 (11:02 +0100)
This reverts commit e5a76af3a2f3324efc60b4b2778ffb29d5c377bc.

gcc/fortran/decl.c
gcc/fortran/match.c
gcc/fortran/match.h
gcc/fortran/resolve.c
gcc/testsuite/gfortran.dg/pr95614_1.f90 [deleted file]
gcc/testsuite/gfortran.dg/pr95614_2.f90 [deleted file]

index 9bfaa60..326e6f5 100644 (file)
@@ -6007,7 +6007,7 @@ get_bind_c_idents (void)
       found_id = MATCH_YES;
       gfc_get_ha_symbol (name, &tmp_sym);
     }
-  else if (gfc_match_common_name (name) == MATCH_YES)
+  else if (match_common_name (name) == MATCH_YES)
     {
       found_id = MATCH_YES;
       com_block = gfc_get_common (name, 0);
@@ -6052,7 +6052,7 @@ get_bind_c_idents (void)
              found_id = MATCH_YES;
              gfc_get_ha_symbol (name, &tmp_sym);
            }
-         else if (gfc_match_common_name (name) == MATCH_YES)
+         else if (match_common_name (name) == MATCH_YES)
            {
              found_id = MATCH_YES;
              com_block = gfc_get_common (name, 0);
index bee73e7..cb09c5f 100644 (file)
@@ -5166,8 +5166,7 @@ gfc_get_common (const char *name, int from_module)
 
 /* Match a common block name.  */
 
-match
-gfc_match_common_name (char *name)
+match match_common_name (char *name)
 {
   match m;
 
@@ -5219,7 +5218,7 @@ gfc_match_common (void)
 
   for (;;)
     {
-      m = gfc_match_common_name (name);
+      m = match_common_name (name);
       if (m == MATCH_ERROR)
        goto cleanup;
 
index 4ccb596..7bf70d7 100644 (file)
@@ -103,9 +103,11 @@ match gfc_match_call (void);
 
 /* We want to use this function to check for a common-block-name
    that can exist in a bind statement, so removed the "static"
-   declaration of the function in match.c. */
+   declaration of the function in match.c.
  
-match gfc_match_common_name (char *name);
+   TODO: should probably rename this now that it'll be globally seen to
+   gfc_match_common_name.  */
+match match_common_name (char *name);
 
 match gfc_match_common (void);
 match gfc_match_block_data (void);
index 3c767a7..f4ce49f 100644 (file)
@@ -936,16 +936,9 @@ static void
 resolve_common_vars (gfc_common_head *common_block, bool named_common)
 {
   gfc_symbol *csym = common_block->head;
-  gfc_gsymbol *gsym;
 
   for (; csym; csym = csym->common_next)
     {
-      gsym = gfc_find_gsymbol (gfc_gsym_root, csym->name);
-      if (gsym && gsym->type != GSYM_UNKNOWN && gsym->type != GSYM_COMMON)
-       gfc_error_now ("Global entity %qs at %L cannot appear in a "
-                       "COMMON block at %L", gsym->name,
-                       &gsym->where, &csym->common_block->where);
-
       /* gfc_add_in_common may have been called before, but the reported errors
         have been ignored to continue parsing.
         We do the checks again here.  */
diff --git a/gcc/testsuite/gfortran.dg/pr95614_1.f90 b/gcc/testsuite/gfortran.dg/pr95614_1.f90
deleted file mode 100644 (file)
index f835143..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-! { dg-do compile }
-
-module m   ! { dg-error ".1." }
-  common m ! { dg-error "cannot appear in a COMMON" }
-end
-
diff --git a/gcc/testsuite/gfortran.dg/pr95614_2.f90 b/gcc/testsuite/gfortran.dg/pr95614_2.f90
deleted file mode 100644 (file)
index 9d69a50..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-! { dg-do compile }
-
-module m        ! { dg-error ".1." }
-  common /xc/ m ! { dg-error "cannot appear in a COMMON" }
-end
-