re PR fortran/54917 ([OOP] TRANSFER on polymorphic variable causes ICE)

2012-11-06  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/54917
	* target-memory.c (gfc_target_expr_size,gfc_target_interpret_expr):
	Handle BT_CLASS.

2012-11-06  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/54917
	* gfortran.dg/transfer_class_1.f90: New.

From-SVN: r193262
This commit is contained in:
Janus Weil 2012-11-06 23:44:47 +01:00
parent c38fb4c122
commit a2cbcef902
4 changed files with 31 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2012-11-06 Janus Weil <janus@gcc.gnu.org>
PR fortran/54917
* target-memory.c (gfc_target_expr_size,gfc_target_interpret_expr):
Handle BT_CLASS.
2012-10-14 Janus Weil <janus@gcc.gnu.org>
PR fortran/54784

View File

@ -120,6 +120,7 @@ gfc_target_expr_size (gfc_expr *e)
case BT_HOLLERITH:
return e->representation.length;
case BT_DERIVED:
case BT_CLASS:
{
/* Determine type size without clobbering the typespec for ISO C
binding types. */
@ -563,6 +564,9 @@ gfc_target_interpret_expr (unsigned char *buffer, size_t buffer_size,
gfc_interpret_character (buffer, buffer_size, result);
break;
case BT_CLASS:
result->ts = CLASS_DATA (result)->ts;
/* Fall through. */
case BT_DERIVED:
result->representation.length =
gfc_interpret_derived (buffer, buffer_size, result);

View File

@ -1,3 +1,8 @@
2012-11-06 Janus Weil <janus@gcc.gnu.org>
PR fortran/54917
* gfortran.dg/transfer_class_1.f90: New.
2012-11-05 Eric Botcazou <ebotcazou@adacore.com>
* g++.dg/torture/20121105-1.C: New test.

View File

@ -0,0 +1,16 @@
! { dg-do compile }
! { dg-options "-Wsurprising" }
!
! PR 54917: [4.7/4.8 Regression] [OOP] TRANSFER on polymorphic variable causes ICE
!
! Contributed by Sean Santos <quantheory@gmail.com>
subroutine test_routine1(arg)
implicit none
type test_type
integer :: test_comp
end type
class(test_type) :: arg
integer :: i
i = transfer(arg, 1)
end subroutine