Re: -Wall not detecting uninitialized variables

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

 



thank you.

On Wed, Sep 7, 2011 at 12:44 PM, Axel Freyn <axel-freyn@xxxxxx> wrote:
> On Wed, Sep 07, 2011 at 05:36:50PM +0100, Andrew Haley wrote:
>> On 09/07/2011 05:34 PM, sudhakar govindavajhala wrote:
>> > #include <stdio.h>
>> >
>> > int main() {
>> >         int i;
>> >         printf(" hi sud %d \n", i);
>> >         return 0;
>> >
>> > }
>>
>> zebedee:~ $ gcc --version
>> gcc (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)
>>
>> zebedee:~ $ gcc -Wall t.c
>> t.c: In function 'main':
>> t.c:5:15: warning: 'i' is used uninitialized in this function
>
> gcc 4.1 warns if optimization is activated:
> Jupiter:~ $ gcc-4.1 -Wall -O test.c
> test.c: In function ‘main’:
> test.c:5: warning: ‘i’ is used uninitialized in this function
>
> Jupiter:~ $ gcc-4.1 --version
> gcc-4.1 (GCC) 4.1.3 20080704 (prerelease) (Debian 4.1.2-29)
>
> Axel
>



[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