This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/34955] transfer_assumed_size_1.f90: Valgrind error: invalid read of size 3



------- Comment #6 from fxcoudert at gcc dot gnu dot org  2008-03-24 18:43 -------
OK, I now can reproduce it. Here's a reduced testcase:

module TransferBug
  type ByteType
    integer(kind=1) :: singleByte
  end type
  type(ByteType) :: BytesPrototype(1)
contains
  function StringToBytes(v) result (bytes)
    character(len=2) :: v
    type (ByteType) :: bytes(size(transfer(v, BytesPrototype)))
    bytes = transfer('Hi', BytesPrototype)
  end function

  subroutine BytesToString(bytes, string)
    type (ByteType) :: bytes(2)
    character(len=*) :: string
    string = transfer(bytes, string)
  end subroutine
end module

program main
  use TransferBug
  character(len=3) :: str
  call BytesToString( StringToBytes('Hi'), str )
end program


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-03-24 18:43:13
               date|                            |


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]