On Mon, Mar 07, 2011 at 10:14:57AM -0500, Adam Jackson wrote: > On 3/7/11 9:49 AM, 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] > > I'm not able to repro this with -0.12.fc15. Firstly, I have just installed -0.12 and I can reproduce it. > If I had to guess, > you've got a macro for strcmp somewhere that's making type > assumptions. What does the .i file look like if you compile with > -save-temps ? OK ... When you said that, I initially suspected gnulib (which I am using in this code), but I cannot see gnulib doing any macros or replacement of strcmp. Below is how the failure line expands(!) ---------------------------------------------------------------------- if ((__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ((path)) && __builtin_constant_p (("/")) && (__s1_len = strlen ((path)), __s2_len = strlen (("/")), (!((size_t)(const void *)(((path)) + 1) - (size_t)(const void *)((path)) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((("/")) + 1) - (size_t)(const void *)(("/")) == 1) || __s2_len >= 4)) ? __builtin_strcmp ((path), ("/")) : (__builtin_constant_p ((path)) && ((size_t)(const void *)(((path)) + 1) - (size_t)(const void *)((path)) == 1) && (__s1_len = strlen ((path)), __s1_len < 4) ? (__builtin_constant_p (("/")) && ((size_t)(const void *)((("/")) + 1) - (size_t)(const void *)(("/")) == 1) ? __builtin_strcmp ((path), ("/")) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) (("/")); register int __result = (((__const unsigned char *) (__const char *) ((path)))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) ((path)))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) ((path)))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) ((path)))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (("/")) && ((size_t)(const void *)((("/")) + 1) - (size_t)(const void *)(("/")) == 1) && (__s2_len = strlen (("/")), __s2_len < 4) ? (__builtin_constant_p ((path)) && ((size_t)(const void *)(((path)) + 1) - (size_t)(const void *)((path)) == 1) ? __builtin_strcmp ((path), ("/")) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) ((path)); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) (("/")))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) (("/")))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) (("/")))[2]); if (__s2_len > 2 && __result == 0) __resul t = (__s1[3] - ((__const unsigned char *) (__const char *) (("/")))[3]); } } __result; }))) : __builtin_strcmp ((path), ("/"))))); }) == 0)) { ---------------------------------------------------------------------- Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v -- devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/devel