You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Blair Zajac <bl...@orcaware.com> on 2002/12/13 21:46:01 UTC

Inconsistent "might be used uninitialized in this function" warnings

This is really odd.  With gcc 3.2.1 on IRIX, I'm getting the following
two warnings:

subversion/libsvn_wc/adm_ops.c: In function `svn_wc_delete':
subversion/libsvn_wc/adm_ops.c:645: warning: `was_deleted' might be used
uninitialized in this function

subversion/clients/cmdline/status.c: In function `print_status':
subversion/clients/cmdline/status.c:61: warning: `ood_status' might be
used uninitialized in this function

Using gcc 3.2.1 on RedHat 8.0 linux, I get no warnings.  Anybody else
seeing these warnings?  Anybody know why we'd get different warnings
with the same compiler?

The compile statements are very similar:

Linux:

/bin/sh /tmp/svn/libtool --silent --mode=compile gcc -DLINUX=2
-D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE
-D_GNU_SOURCE -g -O2 -Wall -pthread -DNEON_ZLIB -DNEON_SSL
-I./subversion/include -I. -I/tmp/svn/neon/src
-I/opt/i386-linux/db-4.1/include
-I/opt/i386-linux/installed/apache-2.0-cvs-2002121300/include
-I/opt/i386-linux/installed/apache-2.0-cvs-2002121300/include
-I/opt/i386-linux/db-4.1/include -o subversion/libsvn_wc/adm_ops.lo -c
subversion/libsvn_wc/adm_ops.c


IRIX:

/bin/sh /tmp/svn/libtool --silent --mode=compile gcc
-D_POSIX_THREAD_SAFE_FUNCTIONS -g -O2 -Wall
-I/opt/mips-irix/openssl/include -DNEON_ZLIB -DNEON_SSL
-I./subversion/include -I. -I/tmp/svn/neon/src
-I/opt/mips-irix/db-4.1/include -I/tmp/svn/apr/include
-I/tmp/svn/apr-util/include -I/opt/mips-irix/db-4.1/include
-I/tmp/svn/apr-util/xml/expat/lib -o subversion/libsvn_wc/adm_ops.lo
-c subversion/libsvn_wc/adm_ops.c

The warnings look valid and somebody more familar with the code may
want to take a look.

Best,
Blair

-- 
Blair Zajac <bl...@orcaware.com>
Plots of your system's performance - http://www.orcaware.com/orca/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Inconsistent "might be used uninitialized in this function" warnings

Posted by Blair Zajac <bl...@orcaware.com>.
Matt Kraai wrote:
> 
> On Fri, Dec 13, 2002 at 01:46:01PM -0800, Blair Zajac wrote:
> > This is really odd.  With gcc 3.2.1 on IRIX, I'm getting the following
> > two warnings:
> >
> > subversion/libsvn_wc/adm_ops.c: In function `svn_wc_delete':
> > subversion/libsvn_wc/adm_ops.c:645: warning: `was_deleted' might be used
> > uninitialized in this function
> >
> > subversion/clients/cmdline/status.c: In function `print_status':
> > subversion/clients/cmdline/status.c:61: warning: `ood_status' might be
> > used uninitialized in this function
> >
> > Using gcc 3.2.1 on RedHat 8.0 linux, I get no warnings.  Anybody else
> > seeing these warnings?  Anybody know why we'd get different warnings
> > with the same compiler?
> 
> GCC generates these warnings after generating RTL, which can express
> the same operation differently on different targets.  Thus, it may
> discover that the variables are properly initialized on some targets
> but not others.

Thanks, didn't know that.

Best,
Blair

-- 
Blair Zajac <bl...@orcaware.com>
Plots of your system's performance - http://www.orcaware.com/orca/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Inconsistent "might be used uninitialized in this function" warnings

Posted by Matt Kraai <kr...@alumni.cmu.edu>.
On Fri, Dec 13, 2002 at 01:46:01PM -0800, Blair Zajac wrote:
> This is really odd.  With gcc 3.2.1 on IRIX, I'm getting the following
> two warnings:
> 
> subversion/libsvn_wc/adm_ops.c: In function `svn_wc_delete':
> subversion/libsvn_wc/adm_ops.c:645: warning: `was_deleted' might be used
> uninitialized in this function
> 
> subversion/clients/cmdline/status.c: In function `print_status':
> subversion/clients/cmdline/status.c:61: warning: `ood_status' might be
> used uninitialized in this function
> 
> Using gcc 3.2.1 on RedHat 8.0 linux, I get no warnings.  Anybody else
> seeing these warnings?  Anybody know why we'd get different warnings
> with the same compiler?

GCC generates these warnings after generating RTL, which can express
the same operation differently on different targets.  Thus, it may
discover that the variables are properly initialized on some targets
but not others.

Matt

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Inconsistent "might be used uninitialized in this function" warnings

Posted by Dan Wilder <da...@ssc.com>.
On Sat, Dec 14, 2002 at 02:56:22PM +0000, Philip Martin wrote:
> Blair Zajac <bl...@orcaware.com> writes:
> 
> > subversion/libsvn_wc/adm_ops.c: In function `svn_wc_delete':
> > subversion/libsvn_wc/adm_ops.c:645: warning: `was_deleted' might be used
> > uninitialized in this function
> > 
> > subversion/clients/cmdline/status.c: In function `print_status':
> > subversion/clients/cmdline/status.c:61: warning: `ood_status' might be
> > used uninitialized in this function
> 
> By inspection one can see that there is no code path that uses the
> variables if they have not been initialized.  I suppose we could
> change the code to make the compiler quiet, but the warnings do not
> indicate a bug.  I guess the warning uses "might" because it does not
> always get it right.

I'd change the code.

Mostly the changes for this sort of thing are pretty harmless
and trivial.  The benefit is it keeps the compiler quiet about
things you already know about, making it less likely new things
that make it complain will go uninspected.

-- 
-----------------------------------------------------------------
 Dan Wilder <da...@ssc.com>   Technical Manager
 SSC, Inc. P.O. Box 55549   Phone:  206-782-8808
 Seattle, WA  98155-0549    URL http://www.linuxjournal.com/
-----------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Inconsistent "might be used uninitialized in this function" warnings

Posted by Philip Martin <ph...@codematters.co.uk>.
Blair Zajac <bl...@orcaware.com> writes:

> subversion/libsvn_wc/adm_ops.c: In function `svn_wc_delete':
> subversion/libsvn_wc/adm_ops.c:645: warning: `was_deleted' might be used
> uninitialized in this function
> 
> subversion/clients/cmdline/status.c: In function `print_status':
> subversion/clients/cmdline/status.c:61: warning: `ood_status' might be
> used uninitialized in this function

By inspection one can see that there is no code path that uses the
variables if they have not been initialized.  I suppose we could
change the code to make the compiler quiet, but the warnings do not
indicate a bug.  I guess the warning uses "might" because it does not
always get it right.

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org