From 06e8d82eba434c70d409b3d61b37b3427733e904 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Mon, 9 Apr 2018 21:05:13 +0000 Subject: re PR fortran/51260 (PARAMETER array with constructor initializer: Compile-time simplify single element access) 2018-04-09 Thomas Koenig PR fortran/51260 * resolve.c (resolve_variable): Simplify cases where access to a parameter array results in a single constant. 2018-04-09 Thomas Koenig PR fortran/51260 * gfortran.dg/parameter_array_element_3.f90: New test. From-SVN: r259256 --- gcc/fortran/resolve.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gcc/fortran/resolve.c') diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index e28146a..18da947 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -5577,6 +5577,16 @@ resolve_procedure: if (t && flag_coarray == GFC_FCOARRAY_LIB && gfc_is_coindexed (e)) add_caf_get_intrinsic (e); + /* Simplify cases where access to a parameter array results in a + single constant. Suppress errors since those will have been + issued before, as warnings. */ + if (e->rank == 0 && sym->as && sym->attr.flavor == FL_PARAMETER) + { + gfc_push_suppress_errors (); + gfc_simplify_expr (e, 1); + gfc_pop_suppress_errors (); + } + return t; } -- cgit v1.1