------- Comment #3 from pault at gcc dot gnu dot org  2007-11-08 07:16 -------
This fixes the problem.  I'll do something with it when I am back at base -
likely, early next week.

Paul

Index: gcc/fortran/trans-array.c
===================================================================
*** gcc/fortran/trans-array.c   (revision 129882)
--- 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);



! { 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 <[EMAIL PROTECTED]>
!
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


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-11-02 23:06:18         |2007-11-08 07:16:50
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33986

Reply via email to