LLVM/project 096d1cd — clang/lib/CodeGen CGObjCGNU.cpp, clang/test/CodeGenObjC gnustep2-ivar-offset.m
[CodeGen][CGObjCGNU] Fix assertion failure for negative ivar offsets (#215753)
Ivars can have negative offsets, for example if an ivar from a derived
class is placed inside the super classes padding.
Currently, the offset is computed as an `uint64_t`, which results in an
integer wraparound for negative offsets.
The wrapped offset is then written to a global value to be parsed by
libobjc2. When libobjc2 reads the value as a truncated signed `int`, it
is again implicitly converted correct negative number. However, with
assertions enabled we hit an assertion failure in LLVM when creating the
global value. See https://godbolt.org/z/Yb7cvWTqP.