gcc-4.6.0-0.11.fc15.x86_64 breaks strcmp?

yersinia yersinia.spiros at gmail.com
Mon Mar 7 15:37:20 UTC 2011


On Mon, Mar 7, 2011 at 3:49 PM, Richard W.M. Jones <rjones at redhat.com> 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)
>
I remeber that gnu lib have a similar macro, and last year there was a
fix  http://old.nabble.com/-PATCH--define-STREQ%28a,-b%29-consistently,-removing-useless-parentheses-td27293621.html

But also in libvirt apparently
http://www.redhat.com/archives/libvir-list/2010-February/msg00010.html

Dunno if this if OT or no

Regards

Regards

Regards

> AFAIK this code should be correct?  I can't find anything at all about
> this specific error from Google.
>
> 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 at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/devel


More information about the devel mailing list