http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55978
--- Comment #19 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-02-06
12:17:14 UTC ---
(In reply to comment #18)
> Here is an updated patch, which works for pointers and pointer components,
Seems to work better than I expected. However, there is still an issue for:
integer, pointer :: p(:) => null()
call one(p) ! OK
call one() ! Segfault
contains
subroutine one(x)
integer, pointer, optional :: x(:)
call two(x)
end subroutine one
subroutine two(x)
integer, optional :: x(*)
if (present(x)) print *, x(1)
end subroutine two
end
That generates the code:
D.1896 = x != 0B
? (struct array1_integer(kind=4) *) _gfortran_internal_pack (x)
: 0B;
two (D.1896);
if (x != 0B
&& (integer(kind=4)[0:] *) x->data != (integer(kind=4)[0:] *) D.1896)
I think it should be "x != 0B && x->data != 0B" in the first condition.