From 1be4a59a110ba71682a70b352c36e80fb143929b Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 27 Jan 2011 18:51:39 +0000 Subject: Teach -Wuninitialized about indirect goto. Fixes PR 9071. llvm-svn: 124394 --- clang/test/Sema/uninit-variables.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'clang/test/Sema/uninit-variables.c') diff --git a/clang/test/Sema/uninit-variables.c b/clang/test/Sema/uninit-variables.c index 513298d9ac8..f52c1b5fc28 100644 --- a/clang/test/Sema/uninit-variables.c +++ b/clang/test/Sema/uninit-variables.c @@ -229,3 +229,14 @@ void test35(int x) { ^{ y = (x == 0); }(); } +// Test handling of indirect goto. +void test36() +{ + void **pc; // expected-warning{{use of uninitialized variable 'pc'}} expected-note{{ add initialization to silence this warning}} + void *dummy[] = { &&L1, &&L2 }; + L1: + goto *pc; // expected-note{{variable 'pc' is possibly uninitialized when used here}} + L2: + goto *pc; +} + -- cgit v1.2.3