]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.ssa] cmd/compile: panic doesn't return
authorKeith Randall <khr@golang.org>
Sun, 7 Feb 2016 06:35:34 +0000 (22:35 -0800)
committerDavid Chase <drchase@google.com>
Sun, 7 Feb 2016 13:25:33 +0000 (13:25 +0000)
Panic doesn't return, so record that we immediately exit after a panic
call.  This will help code analysis.

Change-Id: I4d1f67494f97b6aee130c43ff4e44307b2b0f149
Reviewed-on: https://go-review.googlesource.com/19303
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/gc/ssa.go

index 71d59208245093f223c205d8f1510d7a43c43fb7..b7019d68b76860c668c289f6e54db6f8f90d9434 100644 (file)
@@ -544,6 +544,15 @@ func (s *state) stmt(n *Node) {
        // Expression statements
        case OCALLFUNC, OCALLMETH, OCALLINTER:
                s.call(n, callNormal)
+               if n.Op == OCALLFUNC && n.Left.Op == ONAME && n.Left.Class == PFUNC && n.Left.Sym.Pkg == Runtimepkg && n.Left.Sym.Name == "gopanic" {
+                       m := s.mem()
+                       b := s.endBlock()
+                       b.Kind = ssa.BlockExit
+                       b.Control = m
+                       // TODO: never rewrite OPANIC to OCALLFUNC in the
+                       // first place.  Need to wait until all backends
+                       // go through SSA.
+               }
        case ODEFER:
                s.call(n.Left, callDefer)
        case OPROC: