Skip to content

Commit fd21616

Browse files
aykevldeadprogram
authored andcommitted
transform: fix poison value in heap-to-stack transform
In #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.
1 parent 066b481 commit fd21616

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

transform/allocs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func OptimizeAllocs(mod llvm.Module, printAllocs *regexp.Regexp, logger func(tok
4141

4242
for _, heapalloc := range getUses(allocator) {
4343
logAllocs := printAllocs != nil && printAllocs.MatchString(heapalloc.InstructionParent().Parent().Name())
44-
if heapalloc.Operand(0).IsAConstant().IsNil() {
44+
if heapalloc.Operand(0).IsAConstantInt().IsNil() {
4545
// Do not allocate variable length arrays on the stack.
4646
if logAllocs {
4747
logAlloc(logger, heapalloc, "size is not constant")

0 commit comments

Comments
 (0)