+2018-04-09 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/51260
+ * resolve.c (resolve_variable): Simplify cases where access to a
+ parameter array results in a single constant.
+
2018-04-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/85102
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;
}
+2018-04-09 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/51260
+ * gfortran.dg/parameter_array_element_3.f90: New test.
+
2018-04-09 Jakub Jelinek <jakub@redhat.com>
PR c++/85194
--- /dev/null
+! { dg-do compile }
+! PR 51260 - an unneeded parameter found its way into the
+! assembly code. Original test case by Tobias Burnus.
+module x
+contains
+ subroutine foo(i)
+ integer, intent(in) :: i
+ end subroutine foo
+end module x
+
+program main
+ use x
+ integer, parameter:: unneeded_parameter (10000)=(/(i,i=1,10000)/)
+ call foo(unneeded_parameter (1))
+ print *,unneeded_parameter (1)
+end program
+! { dg-final { scan-assembler-times "unneeded_parameter" 0 } }