bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] dfa: port to gcc -fsanitize=undefined


From: Eric Blake
Subject: Re: [PATCH] dfa: port to gcc -fsanitize=undefined
Date: Mon, 16 Jan 2017 10:29:34 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

On 01/15/2017 08:09 PM, Paul Eggert wrote:
> * lib/dfa.c (copy): Don’t pass NULL with size 0 to memcpy,
> as this runs afoul of gcc -fsanitize=undefined.

It's lame that gcc warns on that usage; I'm half-tempted to propose a
POSIX bug that various memory functions (memcpy being one of them)
should sanely behave on a length of 0 regardless of the pointer argument
(that is, require that implementations not dereference the pointer when
length is 0).  But even if POSIX accepts such an improvement, we're
still stuck working around existing compilers/system headers that warn.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]