From 76fc461b55cfe334e8d4be121f61fa25d079f8ba Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 16 May 2019 18:05:05 +0200 Subject: pkg/compiler: add offsetof type Similar to C offsetof gives offset of a field from the beginning of the parent struct. We have several TODOs in descriptions asking for this. --- sys/test/test.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'sys/test/test.txt') diff --git a/sys/test/test.txt b/sys/test/test.txt index 1ddc67aa8..a087dd47f 100644 --- a/sys/test/test.txt +++ b/sys/test/test.txt @@ -461,6 +461,27 @@ len_expr4 { test$length30(a0 ptr[in, len_expr1], a1 bytesize[a0:f11], a2 ptr[in, bytesize[a0:f11:f21, int32]], a3 bytesize[a0:f11:f21:f31]) +test$offsetof0(a0 ptr[in, offsetof0]) + +offsetof0 { + f0 int32 + f1 int8 + f2 int16 + f3 int8 + f4 int64 + f5 int32:5 + f6 int32:10 + f7 int64 + o0 offsetof[f0, int32] + o1 offsetof[f1, int32] + o2 offsetof[f2, int32] + o3 offsetof[f3, int32] + o4 offsetof[f4, int32] + o5 offsetof[f5, int32] + o6 offsetof[f6, int32] + o7 offsetof[f7, int32] +} + # Big endian test$end0(a0 ptr[in, syz_end_int_struct]) -- cgit mrf-deployment