aboutsummaryrefslogtreecommitdiffstats
path: root/prog/size_test.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-12-28 11:36:49 +0100
committerAleksandr Nogikh <nogikh@google.com>2024-02-19 11:54:01 +0000
commitbde8fd413bd79491702c8ff7103f5069745574e9 (patch)
tree3031745ef1ea67e50c16d94446246aed20a50fd4 /prog/size_test.go
parent96e91f576713f6e6c16c05f3d1c8130bf5976dc3 (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 'prog/size_test.go')
-rw-r--r--prog/size_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/prog/size_test.go b/prog/size_test.go
index ea8b7a58a..2f7dc9ce2 100644
--- a/prog/size_test.go
+++ b/prog/size_test.go
@@ -166,5 +166,17 @@ test$length11(&(0x7f0000000000)=ANY=[@ANYBLOB="11"], 0x42)
test$length30(&(0x7f0000000000)=ANY=[@ANYBLOB="11"], 0x42, &(0x7f0000000000)=0x43, 0x44)
`,
},
+ {
+ In: "test$length32(&(0x7f0000000000)={[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], {0x0}, &(0x7f0000000040)={0x0}})",
+ Out: "test$length32(&(0x7f0000000000)={[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], {0x8}, &(0x7f0000000040)={0x8}})",
+ },
+ {
+ In: "test$length33(&(0x7f0000000000)={[0x0, 0x0, 0x0, 0x0], 0x0})",
+ Out: "test$length33(&(0x7f0000000000)={[0x0, 0x0, 0x0, 0x0], 0x4})",
+ },
+ {
+ In: "test$length34(&(0x7f0000000000)={[0x0, 0x0, 0x0, 0x0], &(0x7f0000000040)=@u1=0x0})",
+ Out: "test$length34(&(0x7f0000000000)={[0x0, 0x0, 0x0, 0x0], &(0x7f0000000040)=@u1=0x4})",
+ },
})
}