WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Build errors with latest xen-unstable from staging

To: Kamala Narasimhan <kamala.narasimhan@xxxxxxxxx>
Subject: Re: [Xen-devel] Build errors with latest xen-unstable from staging
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Mon, 7 Feb 2011 09:47:02 +0000
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 07 Feb 2011 01:47:50 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4D4EF01F.5050106@xxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Citrix Systems, Inc.
References: <4D4EF01F.5050106@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Sun, 2011-02-06 at 19:01 +0000, Kamala Narasimhan wrote:
> FYI - Pulled the latest xen-unstable from staging to sync some patches and got
> these trivial errors while compiling -
> 
> xl_cmdimpl.c: In function ‘print_domain_vcpuinfo’:
> xl_cmdimpl.c:3351: warning: ‘firstset’ may be used uninitialized in this 
> function
> xl_cmdimpl.c:3351: note: ‘firstset’ was declared here
> xl_cmdimpl.c:3350: warning: ‘bitmask’ may be used uninitialized in this 
> function
> xl_cmdimpl.c:3350: note: ‘bitmask’ was declared here
> xl_cmdimpl.c:3350: warning: ‘pmap’ may be used uninitialized in this function
> xl_cmdimpl.c:3350: note: ‘pmap’ was declared here
> 
> GCC version - 4.2.4.  Initializing the three variables it complained about 
> fixed
> the issue.

They are actually initialised before use, during the first pass through
the for loop when i==0 and state==0, but I can see how gcc would be
unable to figure that out (in fact I'm not sure about firstset myself).

In the Linux kernel they have a macro to annotate such instances:
        /*
         * A trick to suppress uninitialized variable warning without 
generating any
         * code
         */
        #define uninitialized_var(x) x = x
        
Do we want something similar?

>   If this trivial change should require a signed off line, here it is
> - Signed-off-by: Kamala Narasimhan <kamala.narasimhan@xxxxxxxxxx>

Always just assume a change does.

Ian.
> 
> diff -r 7ada6faef565 tools/libxl/xl_cmdimpl.c
> --- a/tools/libxl/xl_cmdimpl.c        Sun Feb 06 17:26:31 2011 +0000
> +++ b/tools/libxl/xl_cmdimpl.c        Sun Feb 06 13:53:50 2011 -0500
> @@ -3347,8 +3347,8 @@ static void print_bitmap(uint8_t *map, i
>  static void print_bitmap(uint8_t *map, int maplen, FILE *stream)
>  {
>      int i;
> -    uint8_t pmap, bitmask;
> -    int firstset, state = 0;
> +    uint8_t pmap = 0, bitmask = 0;
> +    int firstset = 0, state = 0;
> 
>      for (i = 0; i < maplen; i++) {
>          if (i % 8 == 0) {
> 
> Kamala
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel