Blame SOURCES/gcc8-pr95614-revert.patch

c92907
2020-09-28  Jakub Jelinek  <jakub@redhat.com>
c92907
c92907
	Revert:
c92907
	2020-09-27  Steven G. Kargl  <kargl@gcc.gnu.org>
c92907
		    Mark Eggleston  <markeggleston@gcc.gnu.org>
c92907
c92907
	PR fortran/95614
c92907
	* decl.c (gfc_get_common): Use gfc_match_common_name instead
c92907
	of match_common_name.
c92907
	* decl.c (gfc_bind_idents): Use gfc_match_common_name instead
c92907
	of match_common_name.
c92907
	* match.c : Rename match_common_name to gfc_match_common_name.
c92907
	* match.c (gfc_match_common): Use gfc_match_common_name instead
c92907
	of match_common_name.
c92907
	* match.h : Rename match_common_name to gfc_match_common_name.
c92907
	* resolve.c (resolve_common_vars): Check each symbol in a
c92907
	common block has a global symbol.  If there is a global symbol
c92907
	issue an error if the symbol type is known as is not a common
c92907
	block name.
c92907
c92907
--- gcc/fortran/decl.c
c92907
+++ gcc/fortran/decl.c
c92907
@@ -5789,7 +5789,7 @@ get_bind_c_idents (void)
c92907
       found_id = MATCH_YES;
c92907
       gfc_get_ha_symbol (name, &tmp_sym);
c92907
     }
c92907
-  else if (gfc_match_common_name (name) == MATCH_YES)
c92907
+  else if (match_common_name (name) == MATCH_YES)
c92907
     {
c92907
       found_id = MATCH_YES;
c92907
       com_block = gfc_get_common (name, 0);
c92907
@@ -5834,7 +5834,7 @@ get_bind_c_idents (void)
c92907
 	      found_id = MATCH_YES;
c92907
 	      gfc_get_ha_symbol (name, &tmp_sym);
c92907
 	    }
c92907
-	  else if (gfc_match_common_name (name) == MATCH_YES)
c92907
+	  else if (match_common_name (name) == MATCH_YES)
c92907
 	    {
c92907
 	      found_id = MATCH_YES;
c92907
 	      com_block = gfc_get_common (name, 0);
c92907
--- gcc/fortran/match.c
c92907
+++ gcc/fortran/match.c
c92907
@@ -5028,8 +5028,7 @@ gfc_get_common (const char *name, int from_module)
c92907
 
c92907
 /* Match a common block name.  */
c92907
 
c92907
-match
c92907
-gfc_match_common_name (char *name)
c92907
+match match_common_name (char *name)
c92907
 {
c92907
   match m;
c92907
 
c92907
@@ -5073,7 +5072,7 @@ gfc_match_common (void)
c92907
 
c92907
   for (;;)
c92907
     {
c92907
-      m = gfc_match_common_name (name);
c92907
+      m = match_common_name (name);
c92907
       if (m == MATCH_ERROR)
c92907
 	goto cleanup;
c92907
 
c92907
--- gcc/fortran/match.h
c92907
+++ gcc/fortran/match.h
c92907
@@ -103,9 +103,11 @@ match gfc_match_call (void);
c92907
 
c92907
 /* We want to use this function to check for a common-block-name
c92907
    that can exist in a bind statement, so removed the "static"
c92907
-   declaration of the function in match.c. */
c92907
+   declaration of the function in match.c.
c92907
  
c92907
-match gfc_match_common_name (char *name);
c92907
+   TODO: should probably rename this now that it'll be globally seen to
c92907
+   gfc_match_common_name.  */
c92907
+match match_common_name (char *name);
c92907
 
c92907
 match gfc_match_common (void);
c92907
 match gfc_match_block_data (void);
c92907
--- gcc/fortran/resolve.c
c92907
+++ gcc/fortran/resolve.c
c92907
@@ -932,16 +932,9 @@ static void
c92907
 resolve_common_vars (gfc_common_head *common_block, bool named_common)
c92907
 {
c92907
   gfc_symbol *csym = common_block->head;
c92907
-  gfc_gsymbol *gsym;
c92907
 
c92907
   for (; csym; csym = csym->common_next)
c92907
     {
c92907
-      gsym = gfc_find_gsymbol (gfc_gsym_root, csym->name);
c92907
-      if (gsym && gsym->type != GSYM_UNKNOWN && gsym->type != GSYM_COMMON)
c92907
-	gfc_error_now ("Global entity %qs at %L cannot appear in a "
c92907
-			"COMMON block at %L", gsym->name,
c92907
-			&gsym->where, &csym->common_block->where);
c92907
-
c92907
       /* gfc_add_in_common may have been called before, but the reported errors
c92907
 	 have been ignored to continue parsing.
c92907
 	 We do the checks again here.  */