Hi all, the attached patch fixes an ice-on-valid problem, simply by removing an assert. The generated code works as expected and the patch regtests cleanly on x86_64-linux-gnu. Ok for trunk?
Cheers, Janus 2016-11-18 Janus Weil <ja...@gcc.gnu.org> PR fortran/78392 * trans-array.c (gfc_trans_auto_array_allocation): Remove an assert. 2016-11-18 Janus Weil <ja...@gcc.gnu.org> PR fortran/78392 * gfortran.dg/saved_automatic_2.f90: New test case.
Index: gcc/fortran/trans-array.c =================================================================== --- gcc/fortran/trans-array.c (Revision 242586) +++ gcc/fortran/trans-array.c (Arbeitskopie) @@ -5976,7 +5976,6 @@ gfc_trans_auto_array_allocation (tree decl, gfc_sy type = TREE_TYPE (type); gcc_assert (!sym->attr.use_assoc); - gcc_assert (!TREE_STATIC (decl)); gcc_assert (!sym->module); if (sym->ts.type == BT_CHARACTER
! { dg-do run } ! ! PR 78392: ICE in gfc_trans_auto_array_allocation, at fortran/trans-array.c:5979 ! ! Contributed by Janus Weil <ja...@gcc.gnu.org> module mytypes implicit none contains pure integer function get_i () get_i = 13 end function end module program test use mytypes implicit none integer, dimension(get_i()), save :: x if (size(x) /= 13) call abort() end