public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jvdelisle at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/102595] ICE in var_element, at fortran/decl.c:298 since r10-5607-gde89b5748d68b76b
Date: Wed, 18 Jan 2023 04:16:14 +0000	[thread overview]
Message-ID: <bug-102595-4-krObCZlGTU@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102595-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102595

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jvdelisle at gcc dot gnu.org

--- Comment #10 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
The following appears to catch it correctly.  The previous spot I removed after
spotting while checking the addition to primary.cc.  I keep the error message
similar so that existing tests in gfortrn.dg pass without changing.

diff --git a/gcc/fortran/data.cc b/gcc/fortran/data.cc
index 443d35da9cf..d29eb12c1b1 100644
--- a/gcc/fortran/data.cc
+++ b/gcc/fortran/data.cc
@@ -244,13 +244,6 @@ gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue,
mpz_t index,
                    "array-element nor a scalar-structure-component";

   symbol = lvalue->symtree->n.sym;
-  if (symbol->attr.flavor == FL_PARAMETER)
-    {
-      gfc_error ("PARAMETER %qs shall not appear in a DATA statement at %L",
-                symbol->name, &lvalue->where);
-      return false;
-    }
-
   init = symbol->value;
   last_ts = &symbol->ts;
   last_con = NULL;
diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc
index 543d9cc0de4..158f039f225 100644
--- a/gcc/fortran/primary.cc
+++ b/gcc/fortran/primary.cc
@@ -4076,6 +4076,11 @@ match_variable (gfc_expr **result, int equiv_flag, int
host_flag)
          gfc_error ("Named constant at %C in an EQUIVALENCE");
          return MATCH_ERROR;
        }
+      if (gfc_in_match_data())
+       {
+         gfc_error ("PARAMETER %qs shall not appear in a DATA statement at
%C",
+                     sym->name);
+       }
       /* Otherwise this is checked for and an error given in the
         variable definition context checks.  */
       break;

  parent reply	other threads:[~2023-01-18  4:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-04 18:41 [Bug fortran/102595] New: ICE in var_element, at fortran/decl.c:298 gscfq@t-online.de
2021-10-05 20:00 ` [Bug fortran/102595] " anlauf at gcc dot gnu.org
2021-10-11  8:17 ` [Bug fortran/102595] ICE in var_element, at fortran/decl.c:298 since r10-5607-gde89b5748d68b76b marxin at gcc dot gnu.org
2021-12-23 20:13 ` kargl at gcc dot gnu.org
2021-12-23 20:15 ` kargl at gcc dot gnu.org
2021-12-23 23:20 ` kargl at gcc dot gnu.org
2022-12-30  3:26 ` cvs-commit at gcc dot gnu.org
2023-01-14  3:31 ` jvdelisle at gcc dot gnu.org
2023-01-15 20:07 ` jvdelisle at gcc dot gnu.org
2023-01-15 20:17 ` sgk at troutmask dot apl.washington.edu
2023-01-18  4:16 ` jvdelisle at gcc dot gnu.org [this message]
2023-01-21 23:24 ` cvs-commit at gcc dot gnu.org
2023-01-29  4:25 ` jvdelisle at gcc dot gnu.org

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=bug-102595-4-krObCZlGTU@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).