This is the mail archive of the gcc-bugs@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]

[Bug fortran/54917] [4.7/4.8 Regression] [OOP] TRANSFER on polymorphic variable causes ICE


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

--- Comment #9 from janus at gcc dot gnu.org 2012-10-14 11:15:25 UTC ---
Ok, after the ICEs are fixed, let's come to runtime behavior. Here is a test
case:

  implicit none
  type test_type
    integer :: i
  end type
  class(test_type), allocatable :: c
  type(test_type) :: t

  allocate(c)
  c%i=3
  t = transfer(c, t)
  print *,t

end


With ifort and sunf95 this gives the expected output of "3", while gfortran
just spits out random numbers. -fdump-tree-original shows the following:

{
  struct test_type transfer.0;
  integer(kind=8) D.1884;
  integer(kind=8) D.1883;
  integer(kind=8) D.1882;

  D.1882 = 16;
  D.1883 = 4;
  __builtin_memcpy ((void *) &transfer.0, (void *) &c, MAX_EXPR <MIN_EXPR
<D.1883, D.1882>, 0>);
  t = transfer.0;
}

Clearly, the "&c" here should be "&c._data".


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