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] PR 45004: Segfault with allocatable scalars and move_alloc


Hi all,

the attached patch makes the intrinsic subroutine MOVE_ALLOC work with
allocatable scalars and class arguments.

Allocatable scalars did not work, since the library function we call
for MOVE_ALLOC works on array descriptors. Allocatable scalars have no
array descriptors, but are treated similar to scalar pointers.
Therefore we can just translate the MOVE_ALLOC call into two pointer
assignments.

For scalar class arguments we basically do the same, but making use of
'gfc_trans_class_assign' (which had to be refactored a little).

The patch was regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus



2010-07-23  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/45004
	* trans-stmt.h (gfc_trans_class_init_assign): New prototype.
	(gfc_trans_class_assign): Modified prototype.
	* trans.h (gfc_conv_intrinsic_move_alloc): New prototype.
	* trans-expr.c (gfc_trans_class_init_assign): Split off from ...
	(gfc_trans_class_assign): ... here. Modified actual arguments.
	* trans-intrinsic.c (gfc_conv_intrinsic_move_alloc): New function to
	handle the MOVE_ALLOC intrinsic with scalar and class arguments.
	* trans.c (trans_code): Call 'gfc_conv_intrinsic_move_alloc'.


2010-07-23  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/45004
	* gfortran.dg/move_alloc_2.f90: New.

Attachment: pr45004_v2.diff
Description: Binary data

Attachment: move_alloc_2.f90
Description: Binary data


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