http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54784
--- Comment #4 from janus at gcc dot gnu.org 2012-10-02 22:45:31 UTC --- (In reply to comment #1) > > allocate(d%L(2)%B,source=b1) > The code generated for this line has two parts: The allocation and the copying from the source. While the first part looks fine, it seems there is a problem in the second. -fdump-tree-original shows: { struct block D.1890; struct list[2] * D.1889; D.1889 = &d.l; D.1890 = b1; { integer(kind=8) S.0; S.0 = 1; while (1) { if (S.0 > 2) goto L.1; __vtab_bug_Block._copy (&D.1890, (*D.1889)[S.0 + -1].b._data); S.0 = S.0 + 1; } L.1:; } } In principle only one element of the array 'd.l' should be copied. However, it seems like the while loop does a copy for each element!