summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/uninit-variables.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-07-14 05:04:10 +0000
committerTed Kremenek <kremenek@apple.com>2012-07-14 05:04:10 +0000
commitb50e716bac45a9713144869b01c2850ef8048100 (patch)
tree0277aa2738596438d54cbe59b51d56264031ae5f /clang/test/Sema/uninit-variables.c
parenta16436f51e83ba5b55540b96c266c3c6265381cf (diff)
downloadbcm5719-llvm-b50e716bac45a9713144869b01c2850ef8048100.tar.gz
bcm5719-llvm-b50e716bac45a9713144869b01c2850ef8048100.zip
Refine CFG so that '&&' and '||' don't lead to extra confluence points when used in a branch, but
instead push the terminator for the branch down into the basic blocks of the subexpressions of '&&' and '||' respectively. This eliminates some artifical control-flow from the CFG and results in a more compact CFG. Note that this patch only alters the branches 'while', 'if' and 'for'. This was complex enough for one patch. The remaining branches (e.g., do...while) can be handled in a separate patch, but they weren't immediately tackled because they were less important. It is possible that this patch introduces some subtle bugs, particularly w.r.t. to destructor placement. I've tried to audit these changes, but it is also known that the destructor logic needs some refinement in the area of '||' and '&&' regardless (i.e., their are known bugs). llvm-svn: 160218
Diffstat (limited to 'clang/test/Sema/uninit-variables.c')
-rw-r--r--clang/test/Sema/uninit-variables.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/test/Sema/uninit-variables.c b/clang/test/Sema/uninit-variables.c
index 71ce76c3e31..2630b70ec08 100644
--- a/clang/test/Sema/uninit-variables.c
+++ b/clang/test/Sema/uninit-variables.c
@@ -152,15 +152,15 @@ int test19() {
int test20() {
int z; // expected-note{{initialize the variable 'z' to silence this warning}}
- if ((test19_aux1() + test19_aux2() && test19_aux1()) || test19_aux3(&z))
- return z; // expected-warning{{variable 'z' may be uninitialized when used here}}
+ if ((test19_aux1() + test19_aux2() && test19_aux1()) || test19_aux3(&z)) // expected-warning {{variable 'z' is used uninitialized whenever '||' condition is true}} expected-note {{remove the '||' if its condition is always false}}
+ return z; // expected-note {{uninitialized use occurs here}}
return 0;
}
int test21(int x, int y) {
int z; // expected-note{{initialize the variable 'z' to silence this warning}}
- if ((x && y) || test19_aux3(&z) || test19_aux2())
- return z; // expected-warning{{variable 'z' may be uninitialized when used here}}
+ if ((x && y) || test19_aux3(&z) || test19_aux2()) // expected-warning {{variable 'z' is used uninitialized whenever '||' condition is true}} expected-note {{remove the '||' if its condition is always false}}
+ return z; // expected-note {{uninitialized use occurs here}}
return 0;
}
OpenPOWER on IntegriCloud