[Bug c/45467] gcc won't warn about an uninitialized value

2010-08-31 Thread jellegeerts at gmail dot com
--- Comment #12 from jellegeerts at gmail dot com 2010-08-31 20:54 --- Thanks. :) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45467

[Bug c/45467] gcc won't warn about an uninitialized value

2010-08-31 Thread jakub at gcc dot gnu dot org
--- Comment #11 from jakub at gcc dot gnu dot org 2010-08-31 20:53 --- Because when foo is not static, it has to be compiled. If it is static, GCC figures it is a pure function (only reads memory and arguments and computes from it its return value) and as the result in main of the funct

[Bug c/45467] gcc won't warn about an uninitialized value

2010-08-31 Thread jellegeerts at gmail dot com
--- Comment #10 from jellegeerts at gmail dot com 2010-08-31 20:49 --- Also, it seems a bit questionable to not warn when it is clearly(?) not the developers intent to use an uninitialized variable. What is the rationale behind this? Is it a pragmatic thing? -- http://gcc.gnu.org/bu

[Bug c/45467] gcc won't warn about an uninitialized value

2010-08-31 Thread jellegeerts at gmail dot com
--- Comment #9 from jellegeerts at gmail dot com 2010-08-31 20:47 --- Okay. :) Though, why does GCC warn when we have `#if 1', and not if we have `#if 0'? Just curiosity... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45467

[Bug c/45467] gcc won't warn about an uninitialized value

2010-08-31 Thread manu at gcc dot gnu dot org
--- Comment #8 from manu at gcc dot gnu dot org 2010-08-31 20:37 --- (In reply to comment #7) > Updated code snippet, GCC doesn't warn here either if we leave `#if 0' as-is, > even though the function foo() may have side-effects. No, the function below does not have any side-effects. Th

[Bug c/45467] gcc won't warn about an uninitialized value

2010-08-31 Thread jellegeerts at gmail dot com
--- Comment #7 from jellegeerts at gmail dot com 2010-08-31 20:32 --- Updated code snippet, GCC doesn't warn here either if we leave `#if 0' as-is, even though the function foo() may have side-effects. <<< #include static int array[32]; #if 0 // If '#if 1' is used, GCC wa

[Bug c/45467] gcc won't warn about an uninitialized value

2010-08-31 Thread jellegeerts at gmail dot com
--- Comment #6 from jellegeerts at gmail dot com 2010-08-31 20:14 --- It also happens in functions that do have side-effects. I can give you an example if you want? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45467

[Bug c/45467] gcc won't warn about an uninitialized value

2010-08-31 Thread jakub at gcc dot gnu dot org
--- Comment #5 from jakub at gcc dot gnu dot org 2010-08-31 20:13 --- That's because the whole foo function doesn't have any side-effects, so it is optimized away completely. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45467

[Bug c/45467] gcc won't warn about an uninitialized value

2010-08-31 Thread jellegeerts at gmail dot com
--- Comment #4 from jellegeerts at gmail dot com 2010-08-31 20:04 --- Created an attachment (id=21622) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21622&action=view) `.i' file that GCC created -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45467

[Bug c/45467] gcc won't warn about an uninitialized value

2010-08-31 Thread jellegeerts at gmail dot com
--- Comment #3 from jellegeerts at gmail dot com 2010-08-31 20:03 --- Created an attachment (id=21621) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21621&action=view) the `.i' file that GCC created -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45467

[Bug c/45467] gcc won't warn about an uninitialized value

2010-08-31 Thread jellegeerts at gmail dot com
--- Comment #2 from jellegeerts at gmail dot com 2010-08-31 20:03 --- Created an attachment (id=21620) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21620&action=view) output of `gcc -v -save-temps -std=c99 -O -g -Wall gcctest.c -o gcctest' -- http://gcc.gnu.org/bugzilla/show_

[Bug c/45467] gcc won't warn about an uninitialized value

2010-08-31 Thread jellegeerts at gmail dot com
--- Comment #1 from jellegeerts at gmail dot com 2010-08-31 20:02 --- Created an attachment (id=21619) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21619&action=view) output of `gcc -v -save-temps -std=c99 -O -g -Wall gcctest.c -o gcctest' -- http://gcc.gnu.org/bugzilla/show_