mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
compiler: fix "fragment covers entire variable" bug
This bug could sometimes be triggered by syscall/js code it seems. But it's a generic bug, not specific to WebAssembly.
This commit is contained in:
committed by
Ron Evans
parent
4be9802d26
commit
b44d41d9ec
Vendored
+17
@@ -74,6 +74,14 @@ func main() {
|
||||
//Test deferred builtins
|
||||
testDeferBuiltinClose()
|
||||
testDeferBuiltinDelete()
|
||||
|
||||
// Check for issue 1304.
|
||||
// There are two fields in this struct, one of which is zero-length so the
|
||||
// other covers the entire struct. This led to a verification error for
|
||||
// debug info, which used DW_OP_LLVM_fragment for a field that practically
|
||||
// covered the entire variable.
|
||||
var x issue1304
|
||||
x.call()
|
||||
}
|
||||
|
||||
func runFunc(f func(int), arg int) {
|
||||
@@ -211,3 +219,12 @@ func foo(bar *Bar) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type issue1304 struct {
|
||||
a [0]int // zero-length field
|
||||
b int // field 'b' covers entire struct
|
||||
}
|
||||
|
||||
func (x issue1304) call() {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user