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]

[Patch, fortran] PR30202 - ICE in trans-array.c


:ADDPATCH fortran:

This one is straightforward. The ICE occurs because the backend_decl is used for the deallocation and nullification of the allocatable component. This, of course, does not provide the necessary component reference, in this case. A far better plan is to dereference the parmse.expr, for which the work has already been done. The testcase is that of the reporter.

Regtested on Cygwin_NT/amd64 - OK for trunk and 4.2?

Paul
2006-12-20  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/30202
	* trans-array.c (gfc_conv_function_call): Use parmse.expr for
	the nullifying of intent(out) arguments rather than the backend
	declaration.

2006-12-20  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/30202
	* gfortran.dg/alloc_comp_basics_3.f90: New test.

Index: gcc/fortran/trans-expr.c
===================================================================
*** gcc/fortran/trans-expr.c	(revision 120083)
--- gcc/fortran/trans-expr.c	(working copy)
*************** gfc_conv_function_call (gfc_se * se, gfc
*** 2068,2076 ****
                if (fsym && fsym->attr.allocatable
                    && fsym->attr.intent == INTENT_OUT)
                  {
! 		  tmp = e->symtree->n.sym->backend_decl;
! 		  if (e->symtree->n.sym->attr.dummy)
!                     tmp = build_fold_indirect_ref (tmp);
                    tmp = gfc_trans_dealloc_allocated (tmp);
                    gfc_add_expr_to_block (&se->pre, tmp);
                  }
--- 2068,2074 ----
                if (fsym && fsym->attr.allocatable
                    && fsym->attr.intent == INTENT_OUT)
                  {
!                   tmp = build_fold_indirect_ref (parmse.expr);
                    tmp = gfc_trans_dealloc_allocated (tmp);
                    gfc_add_expr_to_block (&se->pre, tmp);
                  }
Index: gcc/testsuite/gfortran.dg/alloc_comp_basics_3.f90
===================================================================
*** gcc/testsuite/gfortran.dg/alloc_comp_basics_3.f90	(revision 0)
--- gcc/testsuite/gfortran.dg/alloc_comp_basics_3.f90	(revision 0)
***************
*** 0 ****
--- 1,18 ----
+ ! { dg-do compile }
+ ! Test the patch for PR30202 in which the INTENT(OUT)
+ ! caused an ICE.
+ !
+ ! Contributed by Salvatore Filippone <sfilippone@uniroma2.it>
+ !
+ program class_scal_p
+   implicit none
+   type scal_p
+     real, allocatable :: b(:)
+   end type scal_p
+   type(scal_p) :: pd
+   call psb_geallv(pd%b)
+ contains
+   subroutine psb_geallv(x)
+     real, allocatable, intent(out) :: x(:)
+   end subroutine psb_geallv
+ end program class_scal_p

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