[Bug fortran/35830] ICE with PROCEDURE(<interface>) containing array formal arguments
jaydub66 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Apr 5 18:03:00 GMT 2008
------- Comment #2 from jaydub66 at gmail dot com 2008-04-05 18:03 -------
(In reply to comment #1)
> @@ -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;
I guess one should rather use:
formal_arg->sym->as = gfc_copy_array_spec (curr_arg->sym->as);
With this addition your test case works at least with an explicit-size array:
integer a(1:3)
With an assumed-size "integer a(:)" it still fails.
Will try to find out more tomorrow.
> 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
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35830
More information about the Gcc-bugs
mailing list