]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: enforce no uses of Curfn in backend
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 23 Mar 2017 23:39:11 +0000 (16:39 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Sat, 25 Mar 2017 00:09:33 +0000 (00:09 +0000)
Updates #15756

Change-Id: Id8d65ca9a3f1a7f9ea43e26cdd5e7d3befef8ba0
Reviewed-on: https://go-review.googlesource.com/38593
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/gen.go
src/cmd/compile/internal/gc/pgen.go

index c6ef820f0786493ee574e77dd75dab4488c1ccdf..22705b47d1ffda33b98d7d3097229aac1e2eb63f 100644 (file)
@@ -225,5 +225,7 @@ func tempAt(pos src.XPos, curfn *Node, t *Type) *Node {
        // TODO(mdempsky/josharian): Remove all reads and writes of lineno and Curfn.
        lineno = pos
        Curfn = curfn
-       return temp(t)
+       n := temp(t)
+       Curfn = nil
+       return n
 }
index c3030cb8ebda85f99ffc6bb2f0dc91d94b23786d..a525373e2fa37f5ef93357f075bd49c40104cf80 100644 (file)
@@ -299,6 +299,9 @@ func compile(fn *Node) {
                return
        }
 
+       // From this point, there should be no uses of Curfn. Enforce that.
+       Curfn = nil
+
        // Build an SSA backend function.
        ssafn := buildssa(fn)
        if nerrors != 0 {