Fix misalignment of small structs in a Vector (C++) (#7883)

* Rare fix: kick fix test

* Rare fix: real fix

* Rare fix: separate test

* Rare fix: remove comments

* Rare fix: updates

* Rare fix: less

* Rare fix: size_t switch to uoffset_t

* Rare fix: swap exp/val

* Rare fix: add annotated before/after

* Rare fix: remove unnecessary changes

---------

Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
Pavlo Bashmakov
2023-09-28 22:53:50 -07:00
committed by GitHub
parent 053d39adaf
commit 15f16f149e
8 changed files with 138 additions and 6 deletions

View File

@@ -21,4 +21,15 @@ table BadAlignmentRoot {
small: [BadAlignmentSmall];
}
root_type BadAlignmentRoot;
// sizeof(JustSmallStruct) == 2
// alignof(JustSmallStruct) == 1
struct JustSmallStruct {
var_0: uint8;
var_1: uint8;
}
table SmallStructs {
small_structs: [JustSmallStruct];
}
root_type SmallStructs;