[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

Henrik G. Olsson via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 18 13:57:51 PDT 2024


hnrklssn wrote:

This change leads to a crash in the following case:
```
struct S {
};

union U {
    struct S s;
    int x;
};

void foo() {
    union U bar = {};
}
```
`isEmptyRecordForLayout` returns false for `union U` because the recursive call for `U::x` returns false. This means we call `Init->HasSideEffects()` despite `Init` being null (because `ILE->getNumInits()` is `0`).

https://github.com/llvm/llvm-project/pull/96422


More information about the cfe-commits mailing list