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 libfortran/80365] undefined memcpy while writing zero length array on unformatted stream in unix.c


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

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