Richard W.M. Jones wrote:
Compiling libguestfs using gcc-4.6.0-0.11.fc15.x86_64 gives lots of:
error: assuming signed overflow does not occur when changing X +- C1 cmp C2 to X cmp C1
+- C2 [-Werror=strict-overflow]
These seem to be associated with code that does 'if (strcmp (s1, s2) == 0)'
For example:
dir.c: In function ‘do_rm_rf’:
dir.c:59:7: error: assuming signed overflow does not occur when changing X +- C1 cmp C2
to X cmp C1 +- C2 [-Werror=strict-overflow]
----------------------------------------------------------------------
int
do_rm_rf (const char *path)
{
int r;
char *buf, *err;
if (STREQ (path, "/")) { <------ here
reply_with_error ("cannot remove root directory");
return -1;
}
----------------------------------------------------------------------
where STREQ is a simple macro:
#define STREQ(a,b) (strcmp((a),(b)) == 0)
AFAIK this code should be correct? I can't find anything at all about
this specific error from Google.
Hi Rich,
I suspect that there was a problem with .11, perhaps one of these:
* Fri Mar 04 2011 Jakub Jelinek <jakub(a)redhat.com> 4.6.0-0.12
- update from trunk
- PRs c++/46159, c++/46282, c++/47200, c++/47774, c++/47851, c++/47950,
c++/47974, c/47963, libstdc++/47913, middle-end/47283,
rtl-optimization/47925, target/47935, tree-optimization/47890
- rebuilt against ppl 0.11.2, reenable cloog-ppl Requires
because I can't reproduce that with the latest in rawhide,
gcc-4.6.0-0.12.fc15.x86_64:
$ cat k.c :
#define STREQ(a,b) (strcmp((a),(b)) == 0)
int
do_rm_rf (const char *path)
{
int r;
char *buf, *err;
if (STREQ (path, "/"))
{
reply_with_error ("cannot remove root directory");
return -1;
}
}
$ gcc -O3 -c k.c -Werror=strict-overflow :