]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/33986 (ICE on allocatable function result)
authorPaul Thomas <pault@gcc.gnu.org>
Fri, 16 Nov 2007 13:46:04 +0000 (13:46 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Fri, 16 Nov 2007 13:46:04 +0000 (13:46 +0000)
2007-11-16  Paul Thomas  <pault@gcc.gnu.org>

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.

From-SVN: r130228

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 5411776c66854e9746d3d1467863bf33093a499c..776b6520212af25d8617976e60dd9b019da88f53 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 87ef815b2977256f4809cb9dbd12301a99dc8e9d..c418ae2a61a5d55369a8e6c15da5fb0e013a5227 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 46fd19a8110bd520513ab0353a44c19859117d1e..49c708ce9e18d73a8f2a1a4945d20dc489165f78 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