Hi all,
attached patch fixes PR 13092, so that -Wuninitialized no longer warns.
Does it look reasonable?

Joerg
Index: lib/Sema/SemaDecl.cpp
===================================================================
--- lib/Sema/SemaDecl.cpp	(revision 158524)
+++ lib/Sema/SemaDecl.cpp	(working copy)
@@ -6194,7 +6194,7 @@
     void VisitUnaryOperator(UnaryOperator *E) {
       // For POD record types, addresses of its own members are well-defined.
       if (E->getOpcode() == UO_AddrOf && isRecordType && isPODType &&
-          isa<MemberExpr>(E->getSubExpr())) return;
+          isa<MemberExpr>(E->getSubExpr()->IgnoreParens())) return;
       Inherited::VisitUnaryOperator(E);
     } 
 
Index: test/Sema/uninit-variables.c
===================================================================
--- test/Sema/uninit-variables.c	(revision 158524)
+++ test/Sema/uninit-variables.c	(working copy)
@@ -437,3 +437,7 @@
   int c;  // expected-note {{initialize the variable 'c' to silence this warning}}
   ASSIGN(int, c, d);  // expected-warning {{variable 'c' is uninitialized when used here}}
 }
+
+// Taking the address is fine
+struct { struct { void *p; } a; } test55 = { { &test55.a }}; // no-warning
+struct { struct { void *p; } a; } test56 = { { &(test56.a) }}; // no-warning
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to