File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ func (c *Compiler) makeGCStackSlots() bool {
122
122
stackChainStart .SetInitializer (llvm .ConstNull (stackChainStart .Type ().ElementType ()))
123
123
stackChainStart .SetGlobalConstant (true )
124
124
}
125
+ return false
125
126
}
126
127
127
128
trackPointer := c .mod .NamedFunction ("runtime.trackPointer" )
@@ -180,7 +181,13 @@ func (c *Compiler) makeGCStackSlots() bool {
180
181
// Collect some variables used below in the loop.
181
182
stackChainStart := c .mod .NamedGlobal ("runtime.stackChainStart" )
182
183
if stackChainStart .IsNil () {
183
- panic ("stack chain start not found!" )
184
+ // This may be reached in a weird scenario where we call runtime.alloc but the garbage collector is unreachable.
185
+ // This can be accomplished by allocating 0 bytes.
186
+ // There is no point in tracking anything.
187
+ for _ , use := range getUses (trackPointer ) {
188
+ use .EraseFromParentAsInstruction ()
189
+ }
190
+ return false
184
191
}
185
192
stackChainStartType := stackChainStart .Type ().ElementType ()
186
193
stackChainStart .SetInitializer (llvm .ConstNull (stackChainStartType ))
Original file line number Diff line number Diff line change
1
+ package main
2
+ func main () {
3
+ p := []byte {}
4
+ for len (p ) >= 1 {
5
+ p = p [1 :]
6
+ }
7
+ }
You can’t perform that action at this time.
0 commit comments