This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/54917] [4.7/4.8 Regression] [OOP] TRANSFER on polymorphic variable causes ICE
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 14 Oct 2012 11:15:25 +0000
- Subject: [Bug fortran/54917] [4.7/4.8 Regression] [OOP] TRANSFER on polymorphic variable causes ICE
- Auto-submitted: auto-generated
- References: <bug-54917-4@http.gcc.gnu.org/bugzilla/>
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".