OSDN Git Service

2012-11-06 Janus Weil <janus@gcc.gnu.org>
authorjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Nov 2012 22:44:47 +0000 (22:44 +0000)
committerjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Nov 2012 22:44:47 +0000 (22:44 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@193262 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/target-memory.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/transfer_class_1.f90 [new file with mode: 0644]

index 688f572..7257d99 100644 (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
index 6387895..213ee52 100644 (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);
index 8e2c69b..d14f660 100644 (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.
diff --git a/gcc/testsuite/gfortran.dg/transfer_class_1.f90 b/gcc/testsuite/gfortran.dg/transfer_class_1.f90
new file mode 100644 (file)
index 0000000..00b3a24
--- /dev/null
@@ -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