https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70765
Bug ID: 70765
Summary: GCC fails to detect possibly uninitialized variable
Product: gcc
Version: 5.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: mike at conlen dot org
Target Milestone: ---
Created attachment 38329
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38329&action=edit
main() .i file
GCC without an optimization option does not catch a situation where a variable
is used uninitialized (with -Wall -Werror). I can cause gcc to catch this
situation by making the function call which involves passing the unused
variable a call to a function in another translation unit.
Compiler:
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/mconlen/libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-5.3.0/configure --prefix=/home/mconlen
--enable-languages=all
Thread model: posix
gcc version 5.3.0 (GCC)
$
System Type:
$ uname -a
Linux bos-lprll 3.13.0-83-generic #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016
x86_64 x86_64 x86_64 GNU/Linux
$
Building commands:
$ gcc -Wall -Wextra -Werror -save-temps -c test.c
$ gcc -Wall -Wextra -Werror -save-temps -c af.c
$ gcc -Wall -Werror -o test test.o af.o
Compiler output: None
.i files: attached