------- 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 <stdio.h>

static int array[32];

#if 0 // If '#if 1' is used, GCC warns correctly about the use of uninitialized
variable 'i' below.
int foo(void);
int foo(void)
#else
static int foo(void)
#endif
{
    for (int i; i < 32; ++i)
    {
        if (array[i])
            return 1;
    }

    return 0;
}

int main(void)
{
    foo();

    return 0;
}
>>>>>>>>>>>>>>>


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45467

Reply via email to