The following code:
inline int foo(int x)
{
return x;
}
static void bar(int a, int *ptr)
{
do
{
int b;
if (b < 40)
{
ptr[0] = b;
}
b += 1;
ptr++;
}
while (--a != 0);
}
void foobar(int a, int *ptr)
{
bar(foo(a), ptr);
}
generates correct warning when compiled by gcc 4.2.4:
$ gcc -O3 -Wall -Werror -c 1.c
cc1: warnings being treated as errors
1.c: In function âfoobarâ:
1.c:9: warning: âbâ may be used uninitialized in this function
1.c:9: note: âbâ was declared here
But it compiles without any warning with gcc 4.4.0. The bug reproduces on gcc
4.3.1 as well.
--
Summary: missing 'may be used uninitialized' warning
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: regression
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: alexvod at google dot com
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39799