[Libvir] Strange warnings with gcc 4.1.2

Jim Meyering jim at meyering.net
Wed Nov 7 12:52:56 UTC 2007


"Richard W.M. Jones" <rjones at redhat.com> wrote:
> Other warnings:
>
> virsh.c: In function ‘cmdSchedinfo’:
> virsh.c:1138: warning: ‘weight’ may be used uninitialized in this function
> virsh.c:1140: warning: ‘cap’ may be used uninitialized in this function
>
> For some reason gcc appears to have lots its ability to do the data
> flow analysis to find out that these warnings are bogus.  In any case
> the fix is trivial:

Yeah, annoying.  But I'm not sure it's even possible for
the compiler to discover that one.
But something good did come of it: when I was looking at it
yesterday.  I noticed bugs in that use of strtol.

E.g., the caller silently truncates a 64-bit long value to
the "int" return value.   Also, it doesn't detect overflow.

Will send a patch later today, unless someone else wants to do it.




More information about the libvir-list mailing list