| 1 |
// compile |
| 2 |
|
| 3 |
// Copyright 2026 The Go Authors. All rights reserved. |
| 4 |
// Use of this source code is governed by a BSD-style |
| 5 |
// license that can be found in the LICENSE file. |
| 6 |
|
| 7 |
// Issue 80097: ICE "invalid heap allocated var without Heapaddr" |
| 8 |
// when a heap-escaping variable is declared in unreachable code. |
| 9 |
// Escape analysis marks the variable as heap-allocated, but because |
| 10 |
// the declaration is dead, SSA generation never assigns it a heap |
| 11 |
// address. DWARF generation must tolerate this state. |
| 12 |
|
| 13 |
package p |
| 14 |
|
| 15 |
var foo = func() int { |
| 16 |
label: |
| 17 |
goto label |
| 18 |
x := [1024 * 64]*[2]*int{} |
| 19 |
if x != x { |
| 20 |
_ = x |
| 21 |
} |
| 22 |
return 1 |
| 23 |
}() |