[PATCH] D64678: [Sema] Fix -Wuninitialized for struct assignment from GNU C statement expression

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 15 10:07:02 PDT 2019


nickdesaulniers added inline comments.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:10890
+    if (cast<VarDecl>(OrigDecl)->getType()->isRecordType() &&
+        dyn_cast_or_null<StmtExpr>(E)) {
+      return;
----------------
Should just be `dyn_cast<StmtExpr>(E)`?
http://llvm.org/docs/ProgrammersManual.html#the-isa-cast-and-dyn-cast-templates


================
Comment at: clang/test/Sema/warn-uninitialized-statement-expression.c:35
+    struct widget z = my_widget; // expected-warning{{variable 'my_widget' is uninitialized when used within its own initialization}}
+    int x = my_widget.x;         //FIXME: There should be an uninitialized warning here
+    init2(&my_widget);
----------------
Can you please file a bug pointing to this test case?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64678/new/

https://reviews.llvm.org/D64678





More information about the cfe-commits mailing list