program main
  implicit none
  real(kind=10) :: a
  a = 1.1_10
  write(10) a
end program main

Maybe someone could check real(16) as well. I assume only real(10) is affected,
though.

Gives:
==4217== Syscall param write(buf) points to uninitialised byte(s)
==4217==    at 0x5601550: write (in /lib64/libc-2.5.so)
==4217==    by 0x4EBF570: do_write (unix.c:336)
==4217==    by 0x4EBF611: fd_flush (unix.c:386)
==4217==    by 0x4EBD224: _gfortran_st_write_done (transfer.c:2832)
==4217==    by 0x40083D: MAIN__ (in /dev/shm/a.out)
==4217==    by 0x40086B: main (fmain.c:22)
==4217==  Address 0x40517ED is 165 bytes inside a block of size 8,344 alloc'd
==4217==    at 0x4C22D06: malloc (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==4217==    by 0x4E3EF18: _gfortrani_get_mem (memory.c:53)
==4217==    by 0x4EBFFD9: fd_to_stream (unix.c:1043)
==4217==    by 0x4EB9494: _gfortrani_new_unit (open.c:376)
==4217==    by 0x4EBE150: data_transfer_init (transfer.c:1785)
==4217==    by 0x40081C: MAIN__ (in /dev/shm/a.out)
==4217==    by 0x40086B: main (fmain.c:22)


-- 
           Summary: Uninitialized memory when writing real(10) as
                    unformatted
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
GCC target triplet: x86_64-unknown-linux-gnu


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

Reply via email to