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(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org