diff options
author | Ayke van Laethem <[email protected]> | 2022-12-22 00:48:12 +0000 |
---|---|---|
committer | Ron Evans <[email protected]> | 2022-12-22 17:45:05 +0100 |
commit | 9fd0567fb5d2ffbf217e3417f77dce479509f92e (patch) | |
tree | 84af72ce34fc2f428edf9ee8a3b4440a3c1e496c /compiler/testdata | |
parent | 481aba65368e73eff567a108054487a30c9d88d6 (diff) | |
download | tinygo-9fd0567fb5d2ffbf217e3417f77dce479509f92e.tar.gz tinygo-9fd0567fb5d2ffbf217e3417f77dce479509f92e.zip |
compiler: fix stack overflow when creating recursive pointer types
There were two types that could result in a compiler stack overflow.
This is difficult to fix in LLVM 14, so I won't even bother. However,
this is trivial to fix with opaque pointers in LLVM 15. Therefore, this
fix is for LLVM 15 only.
Fixes: https://github.com/tinygo-org/tinygo/issues/3341
Diffstat (limited to 'compiler/testdata')
-rw-r--r-- | compiler/testdata/basic.go | 6 | ||||
-rw-r--r-- | compiler/testdata/basic.ll | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/compiler/testdata/basic.go b/compiler/testdata/basic.go index d2b4a96db..6c6f983e3 100644 --- a/compiler/testdata/basic.go +++ b/compiler/testdata/basic.go @@ -90,3 +90,9 @@ func foo() { // Use this type. func(b kv) {}(kv{}) } + +type T1 []T1 +type T2 [2]*T2 + +var a T1 +var b T2 diff --git a/compiler/testdata/basic.ll b/compiler/testdata/basic.ll index 6ef0dc92c..4daf7b7c5 100644 --- a/compiler/testdata/basic.ll +++ b/compiler/testdata/basic.ll @@ -7,6 +7,8 @@ target triple = "wasm32-unknown-wasi" %main.kv.0 = type { i8, i32, i32, i32 } @main.kvGlobal = hidden global %main.kv zeroinitializer, align 4 [email protected] = hidden global { ptr, i32, i32 } zeroinitializer, align 4 [email protected] = hidden global [2 x ptr] zeroinitializer, align 4 declare noalias nonnull ptr @runtime.alloc(i32, ptr, ptr) #0 |