This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, fortran] PR33986 - ICE on allocatable function result
- From: "Paul Richard Thomas" <paul dot richard dot thomas at gmail dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>, "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Wed, 14 Nov 2007 07:35:23 +0100
- Subject: Re: [Patch, fortran] PR33986 - ICE on allocatable function result
- References: <339c37f20711132232m3deef8a0ld3858dc25be13615@mail.gmail.com>
Sorry, I addeddd the previous patch - herewith the correct one.
Paul
>
--
The knack of flying is learning how to throw yourself at the ground and miss.
--Hitchhikers Guide to the Galaxy
Index: /svn/trunk/gcc/testsuite/gfortran.dg/allocatable_function_3.f90
===================================================================
*** /svn/trunk/gcc/testsuite/gfortran.dg/allocatable_function_3.f90 (revision 0)
--- /svn/trunk/gcc/testsuite/gfortran.dg/allocatable_function_3.f90 (revision 0)
***************
*** 0 ****
--- 1,24 ----
+ ! { dg-do run }
+ ! Tests the fix for PR33986, in which the call to scram would call
+ ! an ICE because allocatable result actuals had not been catered for.
+ !
+ ! Contributed by Damian Rouson <damian@rouson.net>
+ !
+ function transform_to_spectral_from() result(spectral)
+ integer, allocatable :: spectral(:)
+ allocate(spectral(2))
+ call scram(spectral)
+ end function transform_to_spectral_from
+
+ subroutine scram (x)
+ integer x(2)
+ x = (/1,2/)
+ end subroutine
+
+ interface
+ function transform_to_spectral_from() result(spectral)
+ integer, allocatable :: spectral(:)
+ end function transform_to_spectral_from
+ end interface
+ if (any (transform_to_spectral_from () .ne. (/1,2/))) call abort ()
+ end
Index: /svn/trunk/gcc/fortran/trans-array.c
===================================================================
*** /svn/trunk/gcc/fortran/trans-array.c (revision 130157)
--- /svn/trunk/gcc/fortran/trans-array.c (working copy)
*************** gfc_conv_array_parameter (gfc_se * se, g
*** 5003,5009 ****
}
if (sym->attr.allocatable)
{
! if (sym->attr.dummy)
{
gfc_conv_expr_descriptor (se, expr, ss);
se->expr = gfc_conv_array_data (se->expr);
--- 5003,5009 ----
}
if (sym->attr.allocatable)
{
! if (sym->attr.dummy || sym->attr.result)
{
gfc_conv_expr_descriptor (se, expr, ss);
se->expr = gfc_conv_array_data (se->expr);