This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

-Wuninitialized and DoS


Lectoribus Salutem,

I thought - apparently incorrectly - that RTH's removal of
stupid.c and the accompanying changes to run (parts of) 
flow and life-analysis would mean that uninitialized variables
could be warned for even when not optimizing.

Unfortunately, when compiling the following with -Wuninitialized -O:

main()
{
    int i;
    printf("%d",i);
}

I get:

d.c: In function `main':
d.c:3: warning: `i' might be used uninitialized in this function

However, when using -Wuninitialid.c: In function `main':
d.c:3: warning: `i' might be used uninitialized in this function

Sorry, again:

However, when using -Wuninitialized, I get just:

cc1: warning: -Wuninitialized is not supported without -O

Does that mean that the flow and life analysis done without
optimization is simply not enough to determine this, or is
something else going wrong ?

Another interesting example, using Fortran, is:

      SUBROUTINE AAP
      RECIEVED = 0.0
C ...
C ... Other stuff, not involving RECIEVED ...
C ...
      RECEIVED = RECEIVED + 1.0
      PRINT*,RECEIVED
      END

if I issue /usr/snp/bin/g77 -c  -Wuninitialized -O d.f I don't
even get a warning, let alone without -O.

I'd be interested in pointers, as much as ways to determine
this myself ...

Thanks in advance,
Toon.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]