Fix flaw in bitstruct check.

This commit is contained in:
Christoffer Lerno
2024-05-20 22:20:33 +02:00
parent 9436efe554
commit f04d93f9aa

View File

@@ -2017,10 +2017,9 @@ static void llvm_emit_initialize_designated_element(GenContext *c, BEValue *ref,
{ {
llvm_value_struct_gep(c, &value, ref, (unsigned) curr->index); llvm_value_struct_gep(c, &value, ref, (unsigned) curr->index);
} }
if (type->type_kind == TYPE_BITSTRUCT) if (type->type_kind == TYPE_BITSTRUCT && last == current + 1)
{ {
assert(llvm_value_is_addr(&value)); assert(llvm_value_is_addr(&value));
assert(last == current + 1);
Decl *member = type->decl->bitstruct.members[last[0]->index]; Decl *member = type->decl->bitstruct.members[last[0]->index];
// Special handling of bitstructs. // Special handling of bitstructs.
Type *underlying_type = value.type; Type *underlying_type = value.type;