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

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 19:44:43 PDT 2019


rsmith added a comment.

I don't think this problem really has anything to do with statement expressions; consider:

  struct Widget a = (init2(&a), a);

... which has the same behaviour and presumably produces the same warning.

It's just a C / C++ difference. In C++, these examples are undefined because the lifetime of the object hasn't started yet, but I think in C they're valid. We should just disable the whole warning in C mode and leave it to the CFG analysis.


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