Skip to content

Commit 1d62e92

Browse files
committed
test/codegen: make sure assignment results are used.
Some tests make assignments to an argument without reading it. With CL 708865, they are treated as dead stores and are removed. Make sure the results are used. Fixes golang#75745. Fixes golang#75746. Change-Id: I05580beb1006505ec1550e5fa245b54dcefd10b9 Reviewed-on: https://go-review.googlesource.com/c/go/+/708916 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent 4fca798 commit 1d62e92

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

test/codegen/constants.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
package codegen
88

99
// A uint16 or sint16 constant shifted left.
10-
func shifted16BitConstants(out [64]uint64) {
10+
func shifted16BitConstants() (out [64]uint64) {
1111
// ppc64x: "MOVD\t[$]8193,", "SLD\t[$]27,"
1212
out[0] = 0x0000010008000000
1313
// ppc64x: "MOVD\t[$]-32767", "SLD\t[$]26,"
@@ -16,10 +16,11 @@ func shifted16BitConstants(out [64]uint64) {
1616
out[2] = 0xFFFF000000000000
1717
// ppc64x: "MOVD\t[$]65535", "SLD\t[$]44,"
1818
out[3] = 0x0FFFF00000000000
19+
return
1920
}
2021

2122
// A contiguous set of 1 bits, potentially wrapping.
22-
func contiguousMaskConstants(out [64]uint64) {
23+
func contiguousMaskConstants() (out [64]uint64) {
2324
// ppc64x: "MOVD\t[$]-1", "RLDC\tR[0-9]+, [$]44, [$]63,"
2425
out[0] = 0xFFFFF00000000001
2526
// ppc64x: "MOVD\t[$]-1", "RLDC\tR[0-9]+, [$]43, [$]63,"
@@ -30,4 +31,5 @@ func contiguousMaskConstants(out [64]uint64) {
3031
// ppc64x/power9: "MOVD\t[$]-1", "RLDC\tR[0-9]+, [$]33, [$]63,"
3132
// ppc64x/power10: "MOVD\t[$]-8589934591,"
3233
out[3] = 0xFFFFFFFE00000001
34+
return
3335
}

test/codegen/mathbits.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ func Add64MPanicOnOverflowGT(a, b [2]uint64) [2]uint64 {
731731
//
732732
// This is what happened on PPC64 when compiling
733733
// crypto/internal/edwards25519/field.feMulGeneric.
734-
func Add64MultipleChains(a, b, c, d [2]uint64) {
734+
func Add64MultipleChains(a, b, c, d [2]uint64) [2]uint64 {
735735
var cx, d1, d2 uint64
736736
a1, a2 := a[0], a[1]
737737
b1, b2 := b[0], b[1]
@@ -748,6 +748,7 @@ func Add64MultipleChains(a, b, c, d [2]uint64) {
748748
d2, _ = bits.Add64(c2, d2, cx)
749749
d[0] = d1
750750
d[1] = d2
751+
return d
751752
}
752753

753754
// --------------- //

0 commit comments

Comments
 (0)