Wrong packed struct size reported

I am debugging some issue with packed structs in zig lang and I am confused why LLVM is reporting that size of some packed struct type is larger than the sum of field sizes:

LLVMTypeRef struct_type = LLVMStructCreateNamed(LLVMGetGlobalContext(), "TEST_PACKED_STRUCT");
LLVMTypeRef element_types[2] = {LLVMInt8Type(), LLVMIntType(24)};
LLVMStructSetBody(struct_type, element_types, 2, true); // packed = true
size_t struct_size = (size_t)LLVMStoreSizeOfType(g->target_data_ref, struct_type);
size_t total = 0;
for (size_t i = 0; i < 2; i++) {
    size_t fsize = (size_t)LLVMStoreSizeOfType(g->target_data_ref, element_types[i]);
    total += fsize;
}
fprintf(stderr, "TEST_PACKED_STRUCT total field size %lu store size %lu ABISize %llu\n", total, struct_size, LLVMABISizeOfType(g->target_data_ref, struct_type));

The above prints TEST_PACKED_STRUCT total field size 4 store size 5 ABISize 5.
So I get that sum of field sizes is 4 (1+3) but struct size is 5. Can anyone explain what is going on?

I think it’s because StructLayout increments the StructSize by the TypeAllocSize of the field and the i24 is getting a type alloc size of 4.

// Consume space for this data item
StructSize += DL.getTypeAllocSize(Ty).getFixedValue();

But is that expected behavior or is it a bug? To me it seems like a bug since I don’t see how can you logically expect that size to turn out 5.