Commit 06e8d82e by Thomas Koenig

re PR fortran/51260 (PARAMETER array with constructor initializer: Compile-time…

re PR fortran/51260 (PARAMETER array with constructor initializer: Compile-time simplify single element access)

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-09  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/51260
	* gfortran.dg/parameter_array_element_3.f90: New test.

From-SVN: r259256
parent 17434237
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> 2018-04-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/85102 PR fortran/85102
......
...@@ -5577,6 +5577,16 @@ resolve_procedure: ...@@ -5577,6 +5577,16 @@ resolve_procedure:
if (t && flag_coarray == GFC_FCOARRAY_LIB && gfc_is_coindexed (e)) if (t && flag_coarray == GFC_FCOARRAY_LIB && gfc_is_coindexed (e))
add_caf_get_intrinsic (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; 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> 2018-04-09 Jakub Jelinek <jakub@redhat.com>
PR c++/85194 PR c++/85194
......
! { 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 } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment