This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/80365] New: undefined memcpy while writing zero length array on unformatted stream in unix.c
- From: "zeccav at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 08 Apr 2017 07:21:04 +0000
- Subject: [Bug libfortran/80365] New: undefined memcpy while writing zero length array on unformatted stream in unix.c
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80365
Bug ID: 80365
Summary: undefined memcpy while writing zero length array on
unformatted stream in unix.c
Product: gcc
Version: 7.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
Assignee: unassigned at gcc dot gnu.org
Reporter: zeccav at gmail dot com
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
! undefined memcpy writing zero length array on unformatted stream
! must be compiled and run
! ../../../gcc-trunk-246751/libgfortran/io/unix.c:596:7: runtime error: null
pointer passed as argument 2, which is declared to never be null
! unix.c:596 is "memcpy (s->buffer + (s->logical_offset - s->buffer_offset),
buf, nbyte);"
! buf is zero but luckily nbyte is zero as well
! just in case I suggest putting "assert(buf || !nbyte);" before memcpy
real v(1:0)
open(1,form='unformatted',access='stream')
write(unit=1,pos=1) v
end
This is related to bug 67536