OSDN Git Service

2007-11-16 Paul Thomas <pault@gcc.gnu.org>
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Nov 2007 13:46:04 +0000 (13:46 +0000)
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Nov 2007 13:46:04 +0000 (13:46 +0000)
PR fortran/33986
* trans-array.c (gfc_conv_array_parameter ): Allow allocatable
function results.

2007-11-16  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/33986
* gfortran.dg/allocatable_function_3.f90.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130228 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/trans-array.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/allocatable_function_3.f90 [new file with mode: 0644]

index 5411776..776b652 100644 (file)
@@ -1,9 +1,8 @@
-2007-11-15  Tobias Burnus  <burnus@net-b.de>
+2007-11-16  Paul Thomas  <pault@gcc.gnu.org>
 
-       PR fortran/33917
-       * decl.c (match_procedure_decl): Pre-resolve interface.
-       * resolve.c (resolve_symbol): Reject interfaces later
-       declared in procedure statements.
+       PR fortran/33986
+       * trans-array.c (gfc_conv_array_parameter ): Allow allocatable
+       function results.
 
 2007-11-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
index 87ef815..c418ae2 100644 (file)
@@ -5003,7 +5003,7 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77)
         }
       if (sym->attr.allocatable)
         {
-         if (sym->attr.dummy)
+         if (sym->attr.dummy || sym->attr.result)
            {
              gfc_conv_expr_descriptor (se, expr, ss);
              se->expr = gfc_conv_array_data (se->expr);
index 46fd19a..49c708c 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-16  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/33986
+       * gfortran.dg/allocatable_function_3.f90.
+
 2007-11-16  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/34113
diff --git a/gcc/testsuite/gfortran.dg/allocatable_function_3.f90 b/gcc/testsuite/gfortran.dg/allocatable_function_3.f90
new file mode 100644 (file)
index 0000000..538924f
--- /dev/null
@@ -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