public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jerry DeLisle <jvdelisle@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5276] fortran: [PR102595] Date: Sat, 21 Jan 2023 23:24:13 +0000 (GMT) [thread overview] Message-ID: <20230121232413.CF19B3858D32@sourceware.org> (raw) https://gcc.gnu.org/g:48f544ad5c98b668d8d345eaafcf09cc0bd44635 commit r13-5276-g48f544ad5c98b668d8d345eaafcf09cc0bd44635 Author: Jerry DeLisle <jvdelisle@gcc.gnu.org> Date: Sat Jan 21 15:19:57 2023 -0800 fortran: [PR102595] PR fortran/102595 gcc/fortran/ChangeLog: * data.cc (gfc_assign_data_value): Remove check for PARAMETER in DATA. * primary.cc (match_variable): Add check for PARAMETER in DATA. gcc/testsuite/ChangeLog: * gfortran.dg/pr88048.f90: Adjust for changed error message. * gfortran.dg/parameter_data0.f90: New test. Diff: --- gcc/fortran/data.cc | 7 ------- gcc/fortran/primary.cc | 10 ++++++++-- gcc/testsuite/gfortran.dg/parameter_data0.f90 | 6 ++++++ gcc/testsuite/gfortran.dg/pr88048.f90 | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) 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..28ce5fea865 100644 --- a/gcc/fortran/primary.cc +++ b/gcc/fortran/primary.cc @@ -4076,8 +4076,14 @@ match_variable (gfc_expr **result, int equiv_flag, int host_flag) gfc_error ("Named constant at %C in an EQUIVALENCE"); return MATCH_ERROR; } - /* Otherwise this is checked for and an error given in the - variable definition context checks. */ + if (gfc_in_match_data()) + { + gfc_error ("PARAMETER %qs shall not appear in a DATA statement at %C", + sym->name); + return MATCH_ERROR; + } + /* Otherwise this is checked for an error given in the + variable definition context checks. */ break; case FL_PROCEDURE: diff --git a/gcc/testsuite/gfortran.dg/parameter_data0.f90 b/gcc/testsuite/gfortran.dg/parameter_data0.f90 new file mode 100644 index 00000000000..4f1da9ea42e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/parameter_data0.f90 @@ -0,0 +1,6 @@ +! { dg-do compile } +! PR fortran/102595 Similar to 88048 with a zero sized array +program p + complex, parameter:: x(0) = 2 + data x%im /3.0/ ! { dg-error "shall not appear in a DATA statement" } +end diff --git a/gcc/testsuite/gfortran.dg/pr88048.f90 b/gcc/testsuite/gfortran.dg/pr88048.f90 index 11293934330..ad82d45881c 100644 --- a/gcc/testsuite/gfortran.dg/pr88048.f90 +++ b/gcc/testsuite/gfortran.dg/pr88048.f90 @@ -2,6 +2,6 @@ ! PR fortran/88048 program p integer, parameter :: a(2) = 1 - data a(2) /a(1)/ ! { dg-error "definable entity" } + data a(2) /a(1)/ ! { dg-error "shall not appear in a DATA statement" } print *, a end
reply other threads:[~2023-01-21 23:24 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=20230121232413.CF19B3858D32@sourceware.org \ --to=jvdelisle@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: linkBe 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).