http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55978



--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2013-01-14 
21:29:25 UTC ---

For -O0, valgrind complains about



==15263== Conditional jump or move depends on uninitialised value(s)

==15263==    at 0x4F26355: _gfortran_internal_pack (in_pack_generic.c:54)

==15263==    by 0x403762: a3a1.2119 (in /home/ig25/Krempel/Os/a.out)

==15263==    by 0x400B26: MAIN__ (in /home/ig25/Krempel/Os/a.out)

==15263==    by 0x408F0E: main (in /home/ig25/Krempel/Os/a.out)



and



==15263== 

==15263== Conditional jump or move depends on uninitialised value(s)

==15263==    at 0x4F26447: _gfortran_internal_pack (in_pack_generic.c:159)

==15263==    by 0x403762: a3a1.2119 (in /home/ig25/Krempel/Os/a.out)

==15263==    by 0x400B26: MAIN__ (in /home/ig25/Krempel/Os/a.out)

==15263==    by 0x408F0E: main (in /home/ig25/Krempel/Os/a.out)



which is



  size = GFC_DESCRIPTOR_SIZE (source);

  switch (type_size)



and





  dim = GFC_DESCRIPTOR_RANK (source);



respectively.



Reduced test case (run with -fcoarray=single):



! { dg-do run }

! { dg-options "-fcoarray=single" }

!

! PR fortran/50981

! PR fortran/54618

!



  implicit none

  type t

   integer, allocatable :: i

  end type t

  type, extends (t):: t2

   integer, allocatable :: j

  end type t2



  call a3a()



contains



 subroutine a3a(z, z2, z3)

   type(t2), optional :: z(4)

   type(t2), optional, pointer :: z2(:)

   type(t2), optional, allocatable :: z3(:)

   type(t2), allocatable :: x(:)

   type(t2), pointer :: y(:)

   y => null()

   call a4t2(y)

 end subroutine a3a



 subroutine a4t2(x)

   type(t2), intent(in), optional :: x(4)

   if (present (x)) call abort ()

   !print *, present(x)

 end subroutine a4t2



end

Reply via email to