[PATCH] D76782: [CodeGenObjC] Fix a crash when attempting to copy a zero-sized bit-field in a non-trivial C struct

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 3 16:17:02 PDT 2020


ahatanak added a comment.

Thanks for fixing this!



================
Comment at: clang/lib/CodeGen/CGNonTrivialStruct.cpp:545
     LValue DstLV, SrcLV;
     if (FD) {
+      // No need to copy zero-length bit-fields.
----------------
Can you add the same check to `GenBinaryFuncName::visitVolatileTrivial` to avoid encoding the zero-length bit field into the name of the copy constructor/assignment functions? It isn't necessary to generate different functions for `ZeroBitfield`in the test case and the following struct:

```
struct S {
  id strong;
};
```


================
Comment at: clang/test/CodeGenObjC/strong-in-c-struct.m:894
+};
+
+void test_zero_bitfield() {
----------------
Can you check that the zero-sized field information isn't encoded into the name of the copy assignment function?


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

https://reviews.llvm.org/D76782





More information about the cfe-commits mailing list