]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: correctly import labels, gotos, and fallthroughs
authorRobert Griesemer <gri@golang.org>
Wed, 25 May 2016 23:38:02 +0000 (16:38 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 26 May 2016 00:32:03 +0000 (00:32 +0000)
commit30282b091d6c80f4aa37d7c457fa288c3a181573
tree1be7bf033a6c32ed81edcf456247924fb6b268ae
parentb9ec0024fbc18dd94eff7240afd82fac6b4d8fdc
cmd/compile: correctly import labels, gotos, and fallthroughs

The importer had several bugs with respect to labels and gotos:
- it didn't create a new ONAME node for label names (label dcl,
  goto, continue, and break)
- it overwrote the symbol for gotos with the dclstack
- it didn't set the dclstack for labels

In the process changed export format slightly to always assume
a label name for labels and gotos, and never assume a label for
fallthroughs.

For fallthroughs and switch cases, now also set Xoffset like in
the parser. (Not setting it, i.e., using 0 was ok since this is
only used for verifying correct use of fallthroughs, which was
checked already. But it's an extra level of verification of the
import.)

Fixes #15838.

Change-Id: I3637f6314b8651c918df0c8cd70cd858c92bd483
Reviewed-on: https://go-review.googlesource.com/23445
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/gc/bexport.go
src/cmd/compile/internal/gc/bimport.go
test/fixedbugs/issue15838.dir/a.go [new file with mode: 0644]
test/fixedbugs/issue15838.dir/b.go [new file with mode: 0644]
test/fixedbugs/issue15838.go [new file with mode: 0644]