public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/redhat/heads/gcc-8-branch)] Revert "Fortran : ICE in build_field PR95614"
Date: Fri, 23 Apr 2021 10:13:29 +0000 (GMT)	[thread overview]
Message-ID: <20210423101329.DE05F385DC39@sourceware.org> (raw)

https://gcc.gnu.org/g:15809699c7eaeb1718b658e8171a6d21ef7cf4a3

commit 15809699c7eaeb1718b658e8171a6d21ef7cf4a3
Author: Mark Eggleston <markeggleston@gcc.gnu.org>
Date:   Mon Sep 28 11:04:48 2020 +0100

    Revert "Fortran  :  ICE in build_field PR95614"
    
    This reverts commit e28cc38ac34cb4de31b983f817c6e5f7dde55e2c.

Diff:
---
 gcc/fortran/decl.c                      | 4 ++--
 gcc/fortran/match.c                     | 5 ++---
 gcc/fortran/match.h                     | 6 ++++--
 gcc/fortran/resolve.c                   | 7 -------
 gcc/testsuite/gfortran.dg/pr95614_1.f90 | 6 ------
 gcc/testsuite/gfortran.dg/pr95614_2.f90 | 6 ------
 6 files changed, 8 insertions(+), 26 deletions(-)

diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index b3d1ca020b4..6249562de29 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -5789,7 +5789,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);
@@ -5834,7 +5834,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);
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 6ed83532997..9b61f1f52ec 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -5028,8 +5028,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;
 
@@ -5073,7 +5072,7 @@ gfc_match_common (void)
 
   for (;;)
     {
-      m = gfc_match_common_name (name);
+      m = match_common_name (name);
       if (m == MATCH_ERROR)
 	goto cleanup;
 
diff --git a/gcc/fortran/match.h b/gcc/fortran/match.h
index 5d244c237ac..418542bd5a6 100644
--- a/gcc/fortran/match.h
+++ b/gcc/fortran/match.h
@@ -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);
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 7f302522cd6..be63ce50bf2 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -932,16 +932,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
index f835143365a..00000000000
--- a/gcc/testsuite/gfortran.dg/pr95614_1.f90
+++ /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
index 9d69a506384..00000000000
--- a/gcc/testsuite/gfortran.dg/pr95614_2.f90
+++ /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
-


                 reply	other threads:[~2021-04-23 10:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210423101329.DE05F385DC39@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).