diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-12-28 11:36:49 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2024-02-19 11:54:01 +0000 |
| commit | bde8fd413bd79491702c8ff7103f5069745574e9 (patch) | |
| tree | 3031745ef1ea67e50c16d94446246aed20a50fd4 /sys | |
| parent | 96e91f576713f6e6c16c05f3d1c8130bf5976dc3 (diff) | |
pkg/compiler: extend parent reference support in len
Earlier only len[parent, T] was supported and meant the size of the
whole structure.
Logically, len[parent:b, T] should be equivalent to just len[b, T].
Let len[parent:parent:a, T] refer to the structure that encloses the
current one.
Support len fields inside unions.
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/test/test.txt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sys/test/test.txt b/sys/test/test.txt index 1b63cd525..788eb8484 100644 --- a/sys/test/test.txt +++ b/sys/test/test.txt @@ -486,6 +486,37 @@ offsetof0 { o7 offsetof[f7, int32] } +parent_parent_helper { + f1 array[int32, 8] + f2 parent_parent_length + f3 ptr[in, parent_parent_length] +} + +parent_parent_length { + f1 len[parent:parent:f1, int32] +} + +test$length32(a0 ptr[in, parent_parent_helper]) + +one_parent_length { + f1 array[int32, 4] + f2 len[parent:f1, int32] +} + +test$length33(a0 ptr[in, one_parent_length]) + +parent_union_struct { + f1 array[int32, 4] + f2 ptr[in, parent_union] +} + +parent_union [ + u1 len[parent:parent:f1, int32] + u2 int32 +] + +test$length34(a0 ptr[in, parent_union_struct]) + # Big endian test$end0(a0 ptr[in, syz_end_int_struct]) |
