This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR33986 - ICE on allocatable function result


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);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]