aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler/testdata/errors2.txt
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2022-01-04 15:29:10 +0100
committerDmitry Vyukov <dvyukov@google.com>2022-01-11 16:30:08 +0100
commitbad18a53de8fa8d3d097e3d701efb72a014661cb (patch)
tree2ff6cc1aa917897c643d2e4bc5e6ce2098d55a6d /pkg/compiler/testdata/errors2.txt
parenta19c1bce2eee5a1893b4ae9c8292b0f1b2630225 (diff)
pkg/compiler: require stricter resource constructors
Don't consider syscalls that return resources in unions/arrays as constructors. Unions and arrays are problematic because we don't have directed generation in prog.randGen.createResource() and can fail to generate a syscall that returns a particular resource (generate a wrong union option that does not contain the necessary resource). This leads to the following panics: panic: failed to create a resource ifindex with ioctl$sock_SIOCGIFCONF Require each resource to have a constructor syscall that returns the resource outside of unions/arrays.
Diffstat (limited to 'pkg/compiler/testdata/errors2.txt')
-rw-r--r--pkg/compiler/testdata/errors2.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/compiler/testdata/errors2.txt b/pkg/compiler/testdata/errors2.txt
index 40764777c..482314b4a 100644
--- a/pkg/compiler/testdata/errors2.txt
+++ b/pkg/compiler/testdata/errors2.txt
@@ -189,12 +189,15 @@ resource r117[int8] ### resource r117 is never used as an input (such resources
resource r118[int8] ### resource r118 is never used as an input (such resources are not useful)
resource r119[int8] ### resource r119 is never used as an input (such resources are not useful)
resource r120[int8] ### resource r120 can't be created (never mentioned as a syscall return value or output argument/field)
+resource r121[int8] ### resource r121 can't be created (never mentioned as a syscall return value or output argument/field)
foo$300(a0 r100, a1 r101, a2 r102, a3 r103, a4 r104, a5 r105, a6 r106, a7 r107, a8 r108)
foo$301(a0 r109, a1 r110, a2 r111, a3 r112, a4 r113, a5 r114, a6 r115, a7 r120)
foo$302(a ptr[out, array[r103]], b ptr[in, s300], c r107) r104
foo$303(a ptr[in, s302], b ptr[in, s303], c ptr[in, s304], d ptr[out, s305], e ptr[inout, s306], f ptr[inout, s307], g ptr[in, s308], h ptr[out, s310])
foo$304(a ptr[out, r117], b ptr[in, s312], c ptr[in, s313]) r116
+foo$305(a0 r121)
+foo$306(a0 ptr[out, u315])
s300 {
f1 ptr[inout, s301]
@@ -266,6 +269,11 @@ s314 {
f1 r119 (out)
}
+u315 [
+ f1 r121
+ f2 int32
+]
+
# TODO: Two instances of the same resource might exist in the same structure as
# both in and out. How common is this and how to handle this?