http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54618
--- Comment #9 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-09-25 18:37:26 UTC --- Created attachment 28275 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28275 Patch for OPTIONAL This patch fixes the segfaults of the test case in attachment 28269. It also avoids the copy back of _data/_vptr for class_to_class when it cannot change. (Note that this patch also fixes the issues of bug 50981 comment 31 and bug 50981 comment 23.) Still to do: - Fix CLASS(t), ALLOCATABLE, INTENT(OUT) for arrays (cf. comment 0) - More test (cf. comment 8 and bug 50981 comment 36) And the remaining failure of the test case (attachment 28269): For an absent actual to a1a1, subroutine a1a1(z) type(t), optional :: z(:) call a2(z) a present PRESENT(x) check in a2 is wrongly .TRUE. The present check is if (x != 0B && (struct t[0:] *) x->_data.data != 0B) The problem is that the argument in a1a1 is handled as: parm.5.data = (void *) &(*z.0)[0]; class.4._data = parm.5; a2 (&class.4);