Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gccgo: goto over type/const declarations is erroneously rejected #19089

Closed
mdempsky opened this issue Feb 14, 2017 · 1 comment
Closed

gccgo: goto over type/const declarations is erroneously rejected #19089

mdempsky opened this issue Feb 14, 2017 · 1 comment
Milestone

Comments

@mdempsky
Copy link
Member

The Go spec (section "Goto statements") says "Executing the "goto" statement must not cause any variables to come into scope that were not already in scope at the point of the goto."

gccgo erroneously rejects this code:

package p

func f() {
	goto out
	type x int
out:
}

with

/tmp/goto.go:4:2: error: goto jumps over declaration of 'x'
  goto out
  ^
/tmp/goto.go:5:7: note: 'x' defined here
  type x int
       ^

See also #19088.

@mdempsky mdempsky added this to the Gccgo milestone Feb 14, 2017
@gopherbot
Copy link

Change https://golang.org/cl/91696 mentions this issue: compiler: don't error for goto over type or const declaration

hubot pushed a commit to gcc-mirror/gcc that referenced this issue Feb 5, 2018
    
    We should only issue an error for a goto over a var declaration.
    
    The test case for this is already in the master repository, at
    test/fixedbugs/issue8042.go.  It just hasn't been copied into the
    gccgo repository yet.
    
    Fixes golang/go#19089
    
    Reviewed-on: https://go-review.googlesource.com/91696


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@257375 138bc75d-0d04-0410-961f-82ee72b054a4
@golang golang locked and limited conversation to collaborators Feb 5, 2019
asiekierka pushed a commit to WonderfulToolchain/gcc-ia16 that referenced this issue May 16, 2022
    
    We should only issue an error for a goto over a var declaration.
    
    The test case for this is already in the master repository, at
    test/fixedbugs/issue8042.go.  It just hasn't been copied into the
    gccgo repository yet.
    
    Fixes golang/go#19089
    
    Reviewed-on: https://go-review.googlesource.com/91696

From-SVN: r257375
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants