This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/29568] implement unformatted files with subrecords (Intel style)
- From: "jvdelisle at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Nov 2006 07:16:25 -0000
- Subject: [Bug libfortran/29568] implement unformatted files with subrecords (Intel style)
- References: <bug-29568-10391@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #14 from jvdelisle at gcc dot gnu dot org 2006-11-21 07:16 -------
Using the following test program, see the valgrind output. Maybe something not
quite right there. (Though the test passes)
program subrecord
integer, parameter :: reclength = huge(1_4)/16
real, dimension(reclength) :: array
integer :: x
open(unit=10, file="testfile", form="unformatted", access="sequential")
print *, "reclength=",reclength
print *, "arraysize=", 4*reclength
print *, "record size =", 5_8*4_8*reclength+4_8*4_8
array = 2.0
write(10) array,x,array,x,array,x,array,x,array
array = 6.0
write(10) array,x,array,x,array,x,array,x,array
rewind(10)
array = 0.0
read(10) array,x,array,x,array,x,array,x,array
if (any(array.ne.2.0)) print *, "error"
read(10) array,x,array,x,array,x,array,x,array
if (any(array.ne.6.0)) print *, "error"
close(10, status="keep")
end program subrecord
[jerry@quasar test]$ valgrind ./a.out
==32764== Memcheck, a memory error detector.
==32764== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al.
==32764== Using LibVEX rev 1658, a library for dynamic binary translation.
==32764== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.
==32764== Using valgrind-3.2.1, a dynamic binary instrumentation framework.
==32764== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al.
==32764== For more details, rerun with: -v
==32764==
==32764== Warning: set address range perms: large range 536870912 (defined)
reclength= 134217727
arraysize= 536870908
record size = 2684354556
==32764== Syscall param write(buf) points to uninitialised byte(s)
==32764== at 0x31228BFD00: __write_nocancel (in /lib64/libc-2.5.so)
==32764== by 0x21283010: do_write (unix.c:300)
==32764== by 0x212830A3: fd_flush (unix.c:359)
==32764== by 0x212837E7: fd_write (unix.c:718)
==32764== by 0x212820DC: write_buf (transfer.c:593)
==32764== by 0x21282221: unformatted_write (transfer.c:671)
==32764== by 0x2127F289: _gfortran_transfer_array (transfer.c:1419)
==32764== by 0x400CE2: MAIN__ (in /home/jerry/prs/test/a.out)
==32764== by 0x40182D: main (fmain.c:18)
==32764== Address 0x216D873D is 149 bytes inside a block of size 8,344 alloc'd
==32764== at 0x21007879: malloc (vg_replace_malloc.c:149)
==32764== by 0x2121D1F8: _gfortrani_get_mem (memory.c:53)
==32764== by 0x21283279: fd_to_stream (unix.c:1000)
==32764== by 0x21283F5F: _gfortrani_open_external (unix.c:1272)
==32764== by 0x2127D1E7: _gfortrani_new_unit (open.c:374)
==32764== by 0x2127D8F9: _gfortran_st_open (open.c:517)
==32764== by 0x400A5A: MAIN__ (in /home/jerry/prs/test/a.out)
==32764== by 0x40182D: main (fmain.c:18)
==32764==
==32764== Syscall param write(buf) points to uninitialised byte(s)
==32764== at 0x31228BFD00: __write_nocancel (in /lib64/libc-2.5.so)
==32764== by 0x21283010: do_write (unix.c:300)
==32764== by 0x212830A3: fd_flush (unix.c:359)
==32764== by 0x2128359E: fd_alloc_w_at (unix.c:507)
==32764== by 0x21283868: fd_write (unix.c:702)
==32764== by 0x212802BC: next_record_w_unf (transfer.c:2165)
==32764== by 0x21282095: write_buf (transfer.c:607)
==32764== by 0x21282221: unformatted_write (transfer.c:671)
==32764== by 0x400DDF: MAIN__ (in /home/jerry/prs/test/a.out)
==32764== by 0x40182D: main (fmain.c:18)
==32764== Address 0x216D873D is 149 bytes inside a block of size 8,344 alloc'd
==32764== at 0x21007879: malloc (vg_replace_malloc.c:149)
==32764== by 0x2121D1F8: _gfortrani_get_mem (memory.c:53)
==32764== by 0x21283279: fd_to_stream (unix.c:1000)
==32764== by 0x21283F5F: _gfortrani_open_external (unix.c:1272)
==32764== by 0x2127D1E7: _gfortrani_new_unit (open.c:374)
==32764== by 0x2127D8F9: _gfortran_st_open (open.c:517)
==32764== by 0x400A5A: MAIN__ (in /home/jerry/prs/test/a.out)
==32764== by 0x40182D: main (fmain.c:18)
==32764== Warning: set address range perms: large range 536870908 (defined)
==32764== Warning: set address range perms: large range 536870908 (defined)
==32764== Warning: set address range perms: large range 536870908 (defined)
==32764== Warning: set address range perms: large range 536870908 (defined)
==32764== Warning: set address range perms: large range 536870908 (defined)
==32764== Warning: set address range perms: large range 536870908 (defined)
==32764== Warning: set address range perms: large range 536870908 (defined)
==32764== Warning: set address range perms: large range 536870908 (defined)
==32764== Warning: set address range perms: large range 536870908 (defined)
==32764== Warning: set address range perms: large range 536870908 (defined)
==32764==
==32764== ERROR SUMMARY: 10 errors from 2 contexts (suppressed: 5 from 1)
==32764== malloc/free: in use at exit: 0 bytes in 0 blocks.
==32764== malloc/free: 9 allocs, 9 frees, 34,248 bytes allocated.
==32764== For counts of detected errors, rerun with: -v
==32764== All heap blocks were freed -- no leaks are possible.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29568