[Bug fortran/59678] [F03] Segfault on equalizing variables of a complex derived type
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Jan 12 20:43:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59678
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Status|WAITING |NEW
Summary|Segmentation fault on |[F03] Segfault on
|equalizing variables of a |equalizing variables of a
|complex derived data type |complex derived type
--- Comment #11 from janus at gcc dot gnu.org ---
Confirmed. Slightly reduced test case (fails at least with 4.6 up to trunk):
program hello
implicit none
type t3
integer b
integer, allocatable :: vec(:)
end type
type t2
type(t3), allocatable :: obj
end type
type t1
type(t2) :: parts
integer :: a=1
end type
type(t1):: x, y
y=x
end
The dump shows that the assignment is translated into:
{
void * restrict D.2321;
integer(kind=8) D.2320;
integer(kind=8) D.2319;
integer(kind=8) D.2318;
struct t1 D.2317;
D.2317 = y;
y = x;
y.parts = x.parts;
y.parts.obj = x.parts.obj;
if ((void *) x.parts.obj.vec.data != 0B)
{
D.2318 = (x.parts.obj.vec.dim[0].ubound -
x.parts.obj.vec.dim[0].lbound) + 1;
D.2319 = NON_LVALUE_EXPR <D.2318>;
D.2320 = D.2319 * 4;
D.2321 = (void * restrict) __builtin_malloc (MAX_EXPR <(unsigned long)
D.2320, 1>);
y.parts.obj.vec.data = D.2321;
__builtin_memcpy ((integer(kind=4)[0:] * restrict)
y.parts.obj.vec.data, (integer(kind=4)[0:] * restrict) x.parts.obj.vec.data,
(unsigned long) (D.2319 * 4));
}
else
{
y.parts.obj.vec.data = 0B;
}
if (D.2317.parts.obj != 0B)
{
if (D.2317.parts.obj->vec.data != 0B)
{
__builtin_free ((void *) D.2317.parts.obj->vec.data);
}
D.2317.parts.obj->vec.data = 0B;
__builtin_free ((void *) D.2317.parts.obj);
}
D.2317.parts.obj = 0B;
}
More information about the Gcc-bugs
mailing list