Hello world, the attached patch fixes PR 69742 (a regression) by simply not attempting to do function elimination in an assoc list.
Committed as obvious and simple to trunk, the other affected branches will follow shortly. Regards Thomas 2015-02-16 Thomas Koenig <tkoe...@gcc.gnu.org> PR fortran/69742 * frontend-passes.c (cfe-expr_0): Don't register functions from within an ASSOCIATE statement. 2015-02-16 Thomas Koenig <tkoe...@gcc.gnu.org> PR fortran/69742 * gfortran.dg/associate_21.f90: New test.
@@ -734,9 +733,9 @@ cfe_expr_0 (gfc_expr **e, int *walk_subtrees, gfc_expr *newvar; gfc_expr **ei, **ej; - /* Don't do this optimization within OMP workshare. */ + /* Don't do this optimization within OMP workshare or ASSOC lists. */ - if (in_omp_workshare) + if (in_omp_workshare || in_assoc_list) { *walk_subtrees = 0; return 0;
! { dg-do compile } ! { dg-options "-ffrontend-optimize" } ! PR 69742 - this used to ICE with front-end optimizatoin ! Original test case by Marco Restelli. program p implicit none integer, allocatable :: i(:), j allocate( i(5) ) i = (/( j , j=1,5 )/) ! The ICE appears when "size(i)" is used twice in associate associate( i5 => i(size(i):size(i)) ) ! this gives ICE !associate( i5 => i(size(2*i):size(i)) ) ! this works i5 = 2 end associate write(*,*) i end program p