mirror of
https://github.com/golang/go
synced 2024-11-24 09:40:08 -07:00
[dev.ssa] cmd/compile/ssa: fix unit tests
Fix out of bounds array panic due to CL 11238. Change-Id: Id8a46f1ee20cb1f46775d0c04cc4944d729dfceb Reviewed-on: https://go-review.googlesource.com/11540 Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
8c46aa5481
commit
929c2aa2ae
@ -105,6 +105,9 @@ func checkFunc(f *Func) {
|
||||
}
|
||||
|
||||
if v.Op == OpAddr {
|
||||
if len(v.Args) == 0 {
|
||||
f.Fatalf("no args for OpAddr %s", v.LongString())
|
||||
}
|
||||
if v.Args[0].Op != OpSP && v.Args[0].Op != OpSB {
|
||||
f.Fatalf("bad arg to OpAddr %v", v)
|
||||
}
|
||||
|
@ -14,9 +14,10 @@ func TestDeadStore(t *testing.T) {
|
||||
fun := Fun(c, "entry",
|
||||
Bloc("entry",
|
||||
Valu("start", OpArg, TypeMem, 0, ".mem"),
|
||||
Valu("sb", OpSB, TypeInvalid, 0, nil),
|
||||
Valu("v", OpConst, TypeBool, 0, true),
|
||||
Valu("addr1", OpAddr, ptrType, 0, nil),
|
||||
Valu("addr2", OpAddr, ptrType, 0, nil),
|
||||
Valu("addr1", OpAddr, ptrType, 0, nil, "sb"),
|
||||
Valu("addr2", OpAddr, ptrType, 0, nil, "sb"),
|
||||
Valu("store1", OpStore, TypeMem, 0, nil, "addr1", "v", "start"),
|
||||
Valu("store2", OpStore, TypeMem, 0, nil, "addr2", "v", "store1"),
|
||||
Valu("store3", OpStore, TypeMem, 0, nil, "addr1", "v", "store2"),
|
||||
@ -40,8 +41,9 @@ func TestDeadStorePhi(t *testing.T) {
|
||||
fun := Fun(c, "entry",
|
||||
Bloc("entry",
|
||||
Valu("start", OpArg, TypeMem, 0, ".mem"),
|
||||
Valu("sb", OpSB, TypeInvalid, 0, nil),
|
||||
Valu("v", OpConst, TypeBool, 0, true),
|
||||
Valu("addr", OpAddr, ptrType, 0, nil),
|
||||
Valu("addr", OpAddr, ptrType, 0, nil, "sb"),
|
||||
Goto("loop")),
|
||||
Bloc("loop",
|
||||
Valu("phi", OpPhi, TypeMem, 0, nil, "start", "store"),
|
||||
@ -66,9 +68,10 @@ func TestDeadStoreTypes(t *testing.T) {
|
||||
fun := Fun(c, "entry",
|
||||
Bloc("entry",
|
||||
Valu("start", OpArg, TypeMem, 0, ".mem"),
|
||||
Valu("sb", OpSB, TypeInvalid, 0, nil),
|
||||
Valu("v", OpConst, TypeBool, 0, true),
|
||||
Valu("addr1", OpAddr, t1, 0, nil),
|
||||
Valu("addr2", OpAddr, t2, 0, nil),
|
||||
Valu("addr1", OpAddr, t1, 0, nil, "sb"),
|
||||
Valu("addr2", OpAddr, t2, 0, nil, "sb"),
|
||||
Valu("store1", OpStore, TypeMem, 0, nil, "addr1", "v", "start"),
|
||||
Valu("store2", OpStore, TypeMem, 0, nil, "addr2", "v", "store1"),
|
||||
Goto("exit")),
|
||||
|
Loading…
Reference in New Issue
Block a user