Re: [patch. fortran] PR102595 ICE in var_element, at fortran/decl.c
On 1/20/23 9:16 PM, Jerry D wrote: On 1/20/23 5:46 PM, Jerry D wrote: A PARAMETER value is not allowed in a DATA statement, similar to an EQUIVALENCE. The check for this was in gfc_assign_data_value() in data.cc which turns out to be too late when trying to assign a zero sized array. Correction, the chunk in data.cc must remain for one test case. I spotted this after rerunning check-fortran for several variations. Attached patch is revised to include a new test case and adjustment of an existing test case. It also adds in a return MATCH_ERROR I accidentally left of the first submit when I was cleaning some things up. Ok for Mainline? Jeyy 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 000..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
Re: [patch. fortran] PR102595 ICE in var_element, at fortran/decl.c
Hi Jerry, Am 21.01.23 um 19:27 schrieb Jerry D via Gcc-patches: On 1/20/23 9:16 PM, Jerry D wrote: On 1/20/23 5:46 PM, Jerry D wrote: A PARAMETER value is not allowed in a DATA statement, similar to an EQUIVALENCE. The check for this was in gfc_assign_data_value() in data.cc which turns out to be too late when trying to assign a zero sized array. Correction, the chunk in data.cc must remain for one test case. I spotted this after rerunning check-fortran for several variations. Attached patch is revised to include a new test case and adjustment of an existing test case. It also adds in a return MATCH_ERROR I accidentally left of the first submit when I was cleaning some things up. Ok for Mainline? the patch looks good to me, so ok for mainline. But please provide a commit message next time. Thanks, Harald Jeyy
Re: [patch, gfortran.dg] Adjust numerous tests so that they pass on line endings
On 1/20/23 6:13 PM, Jerry DeLisle via Fortran wrote: Hi all, The attached patch modifies the following tests to check for line endings. Some test environments inject superfluous /r characters at ends of lines. The expression matching in dg-output tests are changed from: (\n|\r\n|\r) to (\r*\n+) This allows these tests to pass. The failing tests tend to mask the real bugs in these systems. The changes were provided by Nightstrike who has tested on the troublesome environment. I ran the tests successfully on Linux. I do not know if anyone has tested on Mac or some of the other system that use odd line endings. OK for trunk? What about for 12? Regards, Jerry modified: gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90 modified: gcc/testsuite/gfortran.dg/array_temporaries_2.f90 modified: gcc/testsuite/gfortran.dg/bind-c-contiguous-1.f90 modified: gcc/testsuite/gfortran.dg/bind-c-contiguous-4.f90 modified: gcc/testsuite/gfortran.dg/bind-c-contiguous-5.f90 modified: gcc/testsuite/gfortran.dg/fmt_error_4.f90 modified: gcc/testsuite/gfortran.dg/fmt_error_5.f90 modified: gcc/testsuite/gfortran.dg/fmt_float.f90 modified: gcc/testsuite/gfortran.dg/fmt_l.f90 modified: gcc/testsuite/gfortran.dg/fmt_nonchar_2.f90 modified: gcc/testsuite/gfortran.dg/fmt_zero_precision.f90 modified: gcc/testsuite/gfortran.dg/g77/f77-edit-apostrophe-out.f modified: gcc/testsuite/gfortran.dg/g77/f77-edit-colon-out.f modified: gcc/testsuite/gfortran.dg/g77/f77-edit-h-out.f modified: gcc/testsuite/gfortran.dg/g77/f77-edit-i-out.f modified: gcc/testsuite/gfortran.dg/g77/f77-edit-s-out.f modified: gcc/testsuite/gfortran.dg/g77/f77-edit-slash-out.f modified: gcc/testsuite/gfortran.dg/g77/f77-edit-t-out.f modified: gcc/testsuite/gfortran.dg/g77/f77-edit-x-out.f modified: gcc/testsuite/gfortran.dg/namelist_40.f90 modified: gcc/testsuite/gfortran.dg/namelist_47.f90 modified: gcc/testsuite/gfortran.dg/namelist_print_1.f modified: gcc/testsuite/gfortran.dg/parameter_array_dummy.f90 Proposed ChangeLog entry using git gcc-commit-mklog: Author: Jerry DeLisle Date: Sat Jan 21 15:47:19 2023 -0800 Revise the line end tests to pass on certain windows test environments which inject spurious /r characters. Adjust (\n|\r\n|\r) to (\r*\n+). gcc/testsuite/ChangeLog: * gfortran.dg/ISO_Fortran_binding_17.f90: As noted above. * gfortran.dg/array_temporaries_2.f90: As noted above. * gfortran.dg/bind-c-contiguous-1.f90: As noted above. * gfortran.dg/bind-c-contiguous-4.f90: As noted above. * gfortran.dg/bind-c-contiguous-5.f90: As noted above. * gfortran.dg/fmt_error_4.f90: As noted above. * gfortran.dg/fmt_error_5.f90: As noted above. * gfortran.dg/fmt_float.f90: As noted above. * gfortran.dg/fmt_l.f90: As noted above. * gfortran.dg/fmt_nonchar_2.f90: As noted above. * gfortran.dg/fmt_zero_precision.f90: As noted above. * gfortran.dg/g77/f77-edit-apostrophe-out.f: As noted above. * gfortran.dg/g77/f77-edit-colon-out.f: As noted above. * gfortran.dg/g77/f77-edit-h-out.f: As noted above. * gfortran.dg/g77/f77-edit-i-out.f: As noted above. * gfortran.dg/g77/f77-edit-s-out.f: As noted above. * gfortran.dg/g77/f77-edit-slash-out.f: As noted above. * gfortran.dg/g77/f77-edit-t-out.f: As noted above. * gfortran.dg/g77/f77-edit-x-out.f: As noted above. * gfortran.dg/namelist_40.f90: As noted above. * gfortran.dg/namelist_47.f90: As noted above. * gfortran.dg/namelist_print_1.f: As noted above. * gfortran.dg/parameter_array_dummy.f90: As noted above.
Re: [patch, gfortran.dg] Adjust numerous tests so that they pass on line endings
On Sat, Jan 21, 2023, 18:59 Jerry D via Fortran wrote: > > Proposed ChangeLog entry using git gcc-commit-mklog: > > Author: Jerry DeLisle > Date: Sat Jan 21 15:47:19 2023 -0800 > > Revise the line end tests to pass on certain windows test environments > which inject spurious /r characters. Adjust (\n|\r\n|\r) to (\r*\n+). > Just to be clear, all simulators inject the spurious r's. I replicated the problem on Linux.