C++: Fix offsetof bug.

This commit is contained in:
Geoffrey White
2025-02-20 18:11:14 +00:00
parent 547b082ac3
commit ae25399a47
3 changed files with 2 additions and 2 deletions

View File

@@ -108,6 +108,7 @@ private int isSource(Expr bufferExpr, Element why) {
result = bufferVar.getUnspecifiedType().(ArrayType).getSize() and
why = bufferVar and
not memberMayBeVarSize(_, bufferVar) and
not exists(BuiltInOperationBuiltInOffsetOf offsetof | offsetof.getAChild*() = bufferExpr) and
// zero sized arrays are likely to have special usage, for example
// behaving a bit like a 'union' overlapping other fields.
not result = 0