On 09/14/2016 02:45 AM, David Malcolm wrote:
In combination with -fdiagnostics-generate-patch this can generate output like this:--- ../../src/gcc/testsuite/c-c++-common/fix-missing-initializer-1.c +++ ../../src/gcc/testsuite/c-c++-common/fix-missing-initializer-1.c @@ -2,7 +2,7 @@ int test_int (void) { - int ivar; + int ivar = 0; return ivar; /* { dg-warning "used uninitialized" } */ /* { dg-begin-multiline-output "" } return ivar;
I have to admit I feel uneasy about this. Just initializing stuff to zero is the naive approach to shutting up the warning, but there's no reason to think it's the correct fix. I think this is a warning where a human who understands what's supposed to be going on needs to take a look. Automating the work of a bad programmer seems like it could lead to rather unfortuante outcomes.
Bernd
