------- Comment #1 from davidxl at gcc dot gnu dot org  2010-04-21 00:29 -------
(In reply to comment #0)
> When compiling the source with "-Wall -O", gcc gives the following warning:
> 
> % gcc -c -Wall -O gcc_test.c
> gcc_test.c: In function ?functionLeon?:
> gcc_test.c:11: warning: ?reference? may be used uninitialized in this function
> 
> % cat gcc_test.c
> #include<stdio.h>
> 
> typedef struct {
>   int yb;
> } TCRData;
> 
> void functionLeon (TCRData *pParent, int pBool);
> void functionLeon (TCRData *pParent, int pBool)
> {
>     int isRootCell;
>     TCRData *reference;
> 
>     isRootCell = (pParent == NULL);
> 
>     if (!isRootCell)
>         reference = pParent;
> 
>     if (pBool) {
>        if(!isRootCell)
>           reference->yb++;
>     }
> }
> 
> % gcc -v
> Using built-in specs.
> Target: x86_64-redhat-linux
> Configured with: ../../src/gcc-4.4.0/configure
> --prefix=/remote/depotsrc/depotsrc/amd64-2.4/local_install/gcc-4.4.0
> --enable-bootstrap --enable-shared --enable-threads=posix --disable-checking
> -with-gmp=/remote/depotsrc/depotsrc/amd64-2.4/local_install/gmp-4.3.1
> --with-mpfr=/remote/depotsrc/depotsrc/amd64-2.4/local_install/mpfr-2.4.1
> --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
> --enable-languages=c,c++,fortran --with-cpu=generic 
> --build=x86_64-redhat-linux
> Thread model: posix
> gcc version 4.4.0 (GCC)
> 

This is a common case handled by patch in

http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00706.html


-- 

davidxl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |davidxl at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42643

Reply via email to