This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This is an initial attempt to handle VOPs in -Wuninitialized. Taking the address of a variable messes up uninitialized warnings because VOPs are completely ignored. The following patch tries to detect one particular case [http://gcc.gnu.org/ml/gcc/2007-08/msg00273.html]: extern void foo (int *); extern void bar (int); void baz (void) { int i; if (i) /* { dg-warning "uninit" "uninit i warning" { xfail *-*-* } } */ bar (i); foo (&i); } For this example we create something like: baz (void) { intD.0 iD.1283; intD.0 i.0D.1284; # BLOCK 0, starting at line 7 # PRED: ENTRY (fallthru) # VUSE <iD.1283_1>; i.0D.1284_2 = iD.1283; And that is exactly what the new code tries to detect. I try hard to ignore every other case because they generate false positives while bootstrapping. Any comments? Can we do this better? Can the new code give false positives? Bootstrapped and regression tested on x86_64-unknown-linux-gnu with --enable-languages=all,ada 2008-08-11 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR middle-end/179 * tree-ssa.c (ssa_maybe_uninitialized_var_p): New function. (warn_uninit): Detect VUSE o uninitialized variable. testsuite/ * gcc.dg/uninit-B.c (baz): Remove XFAIL. (baz2): Corresponding negative test. * gcc.dg/uninit-pr19430-O0.c: New. * gcc.dg/uninit-pr19430.c: New.
Attachment:
fix-pr179-try4.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |