verifier: account finite anonymous type sizes exactly
This commit is contained in:
1 parent
03614c9bef
commit
111a3861f9
16 files changed
+226
-8
No files matched your search
@@ -0,0 +1,13 @@
|
||||
; Anonymous nested arrays account exactly one MiB.
|
||||
; expect: accept
|
||||
; phase: 1
|
||||
; spec: docs/spec/08-verifier.md
|
||||
module test.nested_size
|
||||
air 0
|
||||
lang 0.1
|
||||
features [arrays, ownership]
|
||||
|
||||
fn @f(%x: array<array<u8, 1024>, 1024>) -> void
|
||||
effects []
|
||||
entry:
|
||||
ret
|
||||
@@ -0,0 +1,13 @@
|
||||
; Budget arithmetic on an invalid cycle stays bounded and reports excess value size first.
|
||||
; expect: reject E5101
|
||||
; phase: 1
|
||||
; spec: docs/spec/08-verifier.md §7.1; docs/spec/07-air.md §8.6
|
||||
module test.nested_size_cycle
|
||||
air 0
|
||||
lang 0.1
|
||||
features [arrays, ownership]
|
||||
type @A = struct { n: u8, x: array<@A, 4294967296> }
|
||||
fn @f() -> void
|
||||
effects []
|
||||
entry:
|
||||
ret
|
||||
@@ -0,0 +1,15 @@
|
||||
; Each local fits; one extra byte exceeds the frame limit.
|
||||
; expect: reject E5101
|
||||
; phase: 1
|
||||
; spec: docs/spec/08-verifier.md
|
||||
module test.nested_size
|
||||
air 0
|
||||
lang 0.1
|
||||
features [arrays, ownership]
|
||||
|
||||
fn @f() -> void
|
||||
effects []
|
||||
entry:
|
||||
%a = local.alloc array<array<u8, 1024>, 1024>
|
||||
%b = local.alloc u8
|
||||
ret
|
||||
@@ -0,0 +1,14 @@
|
||||
; An unrelated nominal declaration cannot hide a one-GiB anonymous value.
|
||||
; expect: reject E5101
|
||||
; phase: 1
|
||||
; spec: docs/spec/08-verifier.md
|
||||
module test.nested_size
|
||||
air 0
|
||||
lang 0.1
|
||||
features [arrays, ownership]
|
||||
|
||||
type @Unused = struct { n: u8 }
|
||||
fn @f(%x: array<array<array<u8, 1024>, 1024>, 1024>) -> void
|
||||
effects []
|
||||
entry:
|
||||
ret
|
||||
@@ -0,0 +1,13 @@
|
||||
; Mutex accounting includes its array content even without nominal declarations.
|
||||
; expect: reject E5101
|
||||
; phase: 1
|
||||
; spec: docs/spec/08-verifier.md
|
||||
module test.nested_size
|
||||
air 0
|
||||
lang 0.1
|
||||
features [arrays, cancellation, capabilities, effects, ownership, resources, sync, tasks]
|
||||
|
||||
fn @f(%x: mutex<array<u8, 1048576>>) -> mutex<array<u8, 1048576>>
|
||||
effects []
|
||||
entry:
|
||||
ret %x
|
||||
@@ -0,0 +1,13 @@
|
||||
; Anonymous nested-array size overflows checked u64 arithmetic.
|
||||
; expect: reject E5101
|
||||
; phase: 1
|
||||
; spec: docs/spec/08-verifier.md
|
||||
module test.nested_size
|
||||
air 0
|
||||
lang 0.1
|
||||
features [arrays, ownership]
|
||||
|
||||
fn @f(%x: array<array<array<u64, 4294967296>, 4294967296>, 1>) -> void
|
||||
effects []
|
||||
entry:
|
||||
ret
|
||||
@@ -0,0 +1,13 @@
|
||||
; Finite anonymous nesting must not truncate an oversized value.
|
||||
; expect: reject E5101
|
||||
; phase: 1
|
||||
; spec: docs/spec/08-verifier.md
|
||||
module test.nested_size
|
||||
air 0
|
||||
lang 0.1
|
||||
features [arrays, ownership]
|
||||
|
||||
fn @f(%x: array<array<u8, 1024>, 1025>) -> void
|
||||
effects []
|
||||
entry:
|
||||
ret
|
||||
Reference in new issue
Block a user