Skip to content

Commit 7eaaf28

Browse files
committed
[dev.regabi] cmd/compile: disallow taking address of SSA'd values
Adds some extra validation that the frontend is setting flags like Addrtaken correctly. Change-Id: Iffde83e32ba1c4c917ab8cb3fe410a4f623cf635 Reviewed-on: https://go-review.googlesource.com/c/go/+/286434 Run-TryBot: Matthew Dempsky <[email protected]> TryBot-Result: Go Bot <[email protected]> Trust: Matthew Dempsky <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent 6f5e79f commit 7eaaf28

File tree

1 file changed

+5
-0
lines changed
  • src/cmd/compile/internal/ssagen

1 file changed

+5
-0
lines changed

src/cmd/compile/internal/ssagen/ssa.go

+5
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ func buildssa(fn *ir.Func, worker int) *ssa.Func {
434434
// bitmask showing which of the open-coded defers in this function
435435
// have been activated.
436436
deferBitsTemp := typecheck.TempAt(src.NoXPos, s.curfn, types.Types[types.TUINT8])
437+
deferBitsTemp.SetAddrtaken(true)
437438
s.deferBitsTemp = deferBitsTemp
438439
// For this value, AuxInt is initialized to zero by default
439440
startDeferBits := s.entryNewValue0(ssa.OpConst8, types.Types[types.TUINT8])
@@ -5086,6 +5087,10 @@ func (s *state) addr(n ir.Node) *ssa.Value {
50865087
defer s.popLine()
50875088
}
50885089

5090+
if s.canSSA(n) {
5091+
s.Fatalf("addr of canSSA expression: %+v", n)
5092+
}
5093+
50895094
t := types.NewPtr(n.Type())
50905095
linksymOffset := func(lsym *obj.LSym, offset int64) *ssa.Value {
50915096
v := s.entryNewValue1A(ssa.OpAddr, t, lsym, s.sb)

0 commit comments

Comments
 (0)