You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package t
import (
"encoding/binary"
)
type digest struct {
h [5]uint32
x [chunk]byte
nx int
len uint64
}
const (
chunk = 64
magic = "sha\x01"
marshaledSize = len(magic) + 5*4 + chunk + 8
)
func (d *digest) MarshalBinary() ([]byte, error) {
b := make([]byte, 0, marshaledSize)
b = append(b, magic...)
b = binary.BigEndian.AppendUint32(b, d.h[0])
b = binary.BigEndian.AppendUint32(b, d.h[1])
b = binary.BigEndian.AppendUint32(b, d.h[2])
b = binary.BigEndian.AppendUint32(b, d.h[3])
b = binary.BigEndian.AppendUint32(b, d.h[4])
b = append(b, d.x[:d.nx]...)
b = b[:len(b)+len(d.x)-d.nx] // already zero
b = binary.BigEndian.AppendUint64(b, d.len)
return b, nil
}
Compile with GOAMD64=v3.
There are 2 live memories at the start of (*digest).MarshalBinary block b13.
The reason this happens is that there is a BSWAP in b13 and a load in a previous block. When we combine the bswap and the load, we put it in b13, not in the previous block. That's incorrect, we can't move the load - the new combined operation must go in the previous block.
This was noticed by @erifan adding a new compiler phase which, as a side effect, crashes when multiple memories are live at once.
Compile with
GOAMD64=v3
.There are 2 live memories at the start of
(*digest).MarshalBinary
block b13.The reason this happens is that there is a BSWAP in b13 and a load in a previous block. When we combine the bswap and the load, we put it in b13, not in the previous block. That's incorrect, we can't move the load - the new combined operation must go in the previous block.
This was noticed by @erifan adding a new compiler phase which, as a side effect, crashes when multiple memories are live at once.
@wdvxdr1123 @erifan
The text was updated successfully, but these errors were encountered: