[libvirt] Non-zero constant warning on RHEL 6.1 with 0.9.7

Eric Blake eblake at redhat.com
Tue Nov 15 16:02:51 UTC 2011


On 11/15/2011 04:34 AM, Stefan Berger wrote:
> What about this here:
> 
> --- a/src/util/buf.c
> +++ b/src/util/buf.c
> @@ -466,7 +466,11 @@ virBufferEscape(virBufferPtr buf, const char
> *toescape,
>      cur = str;
>      out = escaped;
>      while (*cur != 0) {
> -        if (strchr(toescape, *cur))
> +        /* strchr work-around for gcc 4.3 & 4.4 bug with -Wlogical-op
> +         * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36513
> +         */
> +        char needle[2] = { *cur, 0 };
> +        if (strstr(toescape, needle))
>              *out++ = '\\';
>          *out++ = *cur;
>          cur++;

ACK.  And I finally reproduced the issue with gcc 4.4.6, as well as
confirmed that gcc 4.6.2 is immune; it involves both -O1 (or greater)
and -Wlogical-op at the same time.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111115/30557309/attachment-0001.sig>


More information about the libvir-list mailing list