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: compilation failure for example with non-ASCII package #27836

Closed
thanm opened this issue Sep 24, 2018 · 2 comments
Closed

gccgo: compilation failure for example with non-ASCII package #27836

thanm opened this issue Sep 24, 2018 · 2 comments
Milestone

Comments

@thanm
Copy link
Contributor

thanm commented Sep 24, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

gccgo tip
go version go1.10.3 gccgo (GCC) 9.0.0 20180920 (experimental) linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

linux/amd64

What did you do?

Unpack tar file tarfile.gz
in your $GOPATH, change dir to Äbar, then build.

What did you expect to see?

Clean build

What did you see instead?

$ tar xzvf - < tarfile.gz
./Äbar/
./Äbar/Äbar.go
./Äfoo/
./Äfoo/Äfoo.go
$ cd ./Äbar/
$ go build -compiler gccgo .
$ go build -compiler gccgo  .
# Äbar
./Äbar.go:5:7: error: imported and not used: Äfoo
5 |  "Äfoo"
  |       ^
./Äbar.go:9:45: error: reference to undefined name ‘Äfoo’
9 |  fmt.Printf("Äfoo.Äbar(33) returns %v\n", Äfoo.Äbar(33))
  |                                             ^
$

This program builds cleanly with the regular Go compiler.

I need to spend more time in the debugger, but I think this is a parsing issue, since it is happening very early in the compilation. The call to Äfoo.Äbar is somehow not getting tracked as a reference to the Äfoo package, hence the incorrect error. More investigation needed.

@gopherbot gopherbot added this to the Gccgo milestone Sep 24, 2018
@thanm thanm self-assigned this Sep 24, 2018
@gopherbot
Copy link

Change https://golang.org/cl/137736 mentions this issue: compiler: fix parsing issue with non-ASCII first package char

@gopherbot
Copy link

Change https://golang.org/cl/138075 mentions this issue: test: add testcase for gccgo compile failure

gopherbot pushed a commit that referenced this issue Sep 27, 2018
Also includes a small tweak to test/run.go to allow package names
with Unicode letters (as opposed to just ASCII chars).

Updates #27836

Change-Id: Idbf0bdea24174808cddcb69974dab820eb13e521
Reviewed-on: https://go-review.googlesource.com/138075
Reviewed-by: Cherry Zhang <cherryyz@google.com>
janusw pushed a commit to janusw/gcc that referenced this issue Sep 28, 2018
    
    Fix a bug in the parser code that decides whether a given name should
    be considered exported or not. The function Lex::is_exported_name
    (which assumes that its input is a mangled name) was being called on
    non-mangled (raw utf-8) names in various places. For the bug in
    question this caused an imported package to be registered under the
    wrong name. To fix the issue, rename 'Lex::is_exported_name' to
    'Lex::is_exported_mangled_name', and add a new 'Lex::is_exported_name'
    that works on utf-8 strings.
    
    Fixes golang/go#27836.
    
    Reviewed-on: https://go-review.googlesource.com/137736


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@264690 138bc75d-0d04-0410-961f-82ee72b054a4
@golang golang locked and limited conversation to collaborators Sep 28, 2019
@rsc rsc unassigned thanm Jun 23, 2022
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

2 participants