This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/80365] 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: Sun, 09 Jul 2017 15:43:54 +0000
- Subject: [Bug libfortran/80365] undefined memcpy while writing zero length array on unformatted stream in unix.c
- Auto-submitted: auto-generated
- References: <bug-80365-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80365
--- Comment #4 from Vittorio Zecca <zeccav at gmail dot com> ---
Or you may add
assert(buf);
just before the memcpy library call.
If nbyte==0 then it should be harmless, but undefined.
assert(buf || !nbyte) should catch an error situation