Re:"uninitialized variable" warning from compiler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

     I have few questions about  inbuilt mechanism of  gcc/g++  for
warning about  uninitialized variable.

I am interested in cases where  compiler is unable to warn.  I  am
aware that all the known bugs about  warning-failure are
mentioned  at  bugzilla   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639

a)  The compiler activates the warning mechanism only if  optimisation
is enabled  at compilation time with -O option. For all the bugs that
I went  through at bugzilla,
 the failure is not  -O level dependent.  The warning-failure occurs
for  all levels of
optimisation.  So, I believe this is the general case.

But then I came across the following  failure case.

////////////////////
#include <stdio.h>
int Check(int *a)
{
    if (*a == 0)
    {
        printf("This is sample \n");
    }
    return *a;
}
int main()
{
int call;
Check(&call);
return 0;
}
/////////////////////

This one  fails  to  warn when compiled with any  level  below 3.
With -O3,  gcc  is able to warn.

Can someone tell me which is the corresponding bug logged at bugzilla ?

Are there any more such bugs which  disappear when compiled with
specific -O level ?

b)  Are there any known  "fail to do uninitialised-warning"   gcc bugs
which are language-dependent ?   I mean bugs which occur only in C++ ,
but not in C. ( Bugs which arise out of  C++ language features/syntax. ) .
If so, I would  like to know.

                 thanks for your time
                   Uma shankar


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux