mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-17 03:03:27 +00:00
transform: fix poison value in heap-to-stack transform
In https://github.com/tinygo-org/tinygo/issues/2777, a poison value ended up in `runtime.alloc`. This shouldn't happen, especially not for well written code. So I'm not sure why it happens. But here is a fix anyway.
This commit is contained in:
committed by
Ron Evans
parent
2dc46a851b
commit
ef3b3c0d6a
+1
-1
@@ -41,7 +41,7 @@ func OptimizeAllocs(mod llvm.Module, printAllocs *regexp.Regexp, logger func(tok
|
|||||||
|
|
||||||
for _, heapalloc := range getUses(allocator) {
|
for _, heapalloc := range getUses(allocator) {
|
||||||
logAllocs := printAllocs != nil && printAllocs.MatchString(heapalloc.InstructionParent().Parent().Name())
|
logAllocs := printAllocs != nil && printAllocs.MatchString(heapalloc.InstructionParent().Parent().Name())
|
||||||
if heapalloc.Operand(0).IsAConstant().IsNil() {
|
if heapalloc.Operand(0).IsAConstantInt().IsNil() {
|
||||||
// Do not allocate variable length arrays on the stack.
|
// Do not allocate variable length arrays on the stack.
|
||||||
if logAllocs {
|
if logAllocs {
|
||||||
logAlloc(logger, heapalloc, "size is not constant")
|
logAlloc(logger, heapalloc, "size is not constant")
|
||||||
|
|||||||
Reference in New Issue
Block a user