------- Comment #1 from burnus at gcc dot gnu dot org 2008-04-05 14:56 ------- (Problem was found when creating PR 35831.)
Janus, do you have time to look at it? The invalid read happens for in gfc_is_nodesc_array. The problem is that sym->attr.dimension == 1, sym->dummy == 1 but sym->as == NULL. This of cause fails for: if (sym->as->type != AS_ASSUMED_SHAPE) Hereby, sym->name is the dummy argument "a". First attempt of solving. This gets past the ICE, but the produced code which gives wrong results. ---------------------- --- symbol.c (revision 133937) +++ symbol.c (working copy) @@ -3626,5 +3643,6 @@ add_proc_interface (gfc_symbol *sym, ifs args based on the args of a given named interface. */ -void copy_formal_args (gfc_symbol *dest, gfc_symbol *src) +void +copy_formal_args (gfc_symbol *dest, gfc_symbol *src) { gfc_formal_arglist *head = NULL; @@ -3649,4 +3667,5 @@ void copy_formal_args (gfc_symbol *dest, formal_arg->sym->attr = curr_arg->sym->attr; formal_arg->sym->ts = curr_arg->sym->ts; + formal_arg->sym->as = curr_arg->sym->as; /* If this isn't the first arg, set up the next ptr. For the ---------------------- That the result is wrong can be seen with the following program. ubound of the array is 32 instead of 3: ---------------------- module m contains subroutine one(a) integer a(:) print *, lbound(a), ubound(a), size(a) if ((lbound(a,dim=1) /= 1) .or. (ubound(a,dim=1) /= 3)) & call abort() print *, a if (any(a /= [1,2,3])) call abort() end subroutine one end module m program test use m implicit none call foo(one) contains subroutine foo(f) ! The following interface block is needed ! for NAG f95 as it wrongly does not like ! use-associated interfaces for PROCEDURE ! (It is not needed for gfortran) interface subroutine one(a) integer a(:) end subroutine end interface procedure(one) :: f call f([1,2,3]) end subroutine foo end program test -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jaydub66 at gmail dot com Keywords| |wrong-code Summary|ICE with |ICE with |PROCEDURE(<interface>) |PROCEDURE(<interface>) | |containing array formal | |arguments http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35830