From 160f76ea821e29048389ecb03e8961c4e9cdf519 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 5 Oct 2023 17:40:16 +0200 Subject: pkg/compiler: support (in) for union fields We had a problem -- using inout ANYUNION leads to syzkaller generating copyout instructions for fmt[X, resource] types. Add a validation rule to detect this during tests. Fix this by supporting (in) for union fields. Previously, all union field direction attributes were banned as they were making things more complicated. The (in) attribute is definitely safe and allows for more flexibility. --- pkg/compiler/testdata/errors.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pkg/compiler/testdata/errors.txt') diff --git a/pkg/compiler/testdata/errors.txt b/pkg/compiler/testdata/errors.txt index 9d625a34b..83b62cfb6 100644 --- a/pkg/compiler/testdata/errors.txt +++ b/pkg/compiler/testdata/errors.txt @@ -419,8 +419,9 @@ union$overlay0 [ ] union$directions [ - f1 int32 (in) ### unknown arg/field f1 attribute in + f1 int32 (in) f2 int32 (out) ### unknown arg/field f2 attribute out + f3 int32 (inout) ### unknown arg/field f3 attribute inout ] -- cgit mrf-deployment