cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/03/12:09:33

From: Ian D Romanick <idr AT cs DOT pdx DOT edu>
Message-Id: <199802031705.JAA18651@sirius.cs.pdx.edu>
Subject: Re: Variable might be uninitialized
To: geza AT inf DOT bme DOT hu (Geza Herman)
Date: Tue, 3 Feb 1998 09:05:11 -0800 (PST)
Cc: djgpp AT delorie DOT com
In-Reply-To: <Pine.GSO.3.95.980203160445.3025A-100000@kempelen.inf.bme.hu> from "Geza Herman" at Feb 3, 98 04:08:13 pm
MIME-Version: 1.0

> 	What does this compiler warning message mean:
> 
> 	'<variable> might be uninitialized'
> 
> 	This only happens when I use optimization( -O2 ). My program runs
> fine, but then what is this warning message? Should I look the assembly
> code to check if this message is true or not?

It simply means that gcc has detected some code path where the specified
variable might be used before it is initialized.  In the following code
snip, 'x' generates such a warning:

void foo( int z )
{
    int x;
    
    
    if ( z == 0 )
        x = 5;
	
    printf( "%d\n", x );
}

To quote the gcc documentation, "These warnings are possible only in
optimizing compilation, because they require data flow information that is
computed only when optimizing.  If you don't specify `-O', you simply won't
get these warnings."

-- 
"Now all the people who made fun of you in high school can see
what a successful freak you've become."

                                                    http://www.cs.pdx.edu/~idr

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019