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

gollvm/gofrontend: unnamed bool convert error #52535

Closed
HangGa0 opened this issue Apr 25, 2022 · 3 comments
Closed

gollvm/gofrontend: unnamed bool convert error #52535

HangGa0 opened this issue Apr 25, 2022 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@HangGa0
Copy link

HangGa0 commented Apr 25, 2022

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

$ go version : go llvm 

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env / x86

What did you do?

I got a assert fail for gollvm when compiling test/fixedbugs/issue16870.go

the assert is in function names.cc / Gogo::type_descriptor_backend_name

It is caused by the example like this.

when there is a channel/map/... used with an empty interface like this:

func test(got, want interface{})

var ok interface{}

m:=make(map[int]int)

i, ok = m[0]

test(ok,false)

If we receive the bool value from the i, ok = m[0] and convert it to an empty interface, the assert will be triggered

What did you expect to see?

test passed

What did you see instead?

compiler assert

@thanm thanm added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 25, 2022
@thanm
Copy link
Contributor

thanm commented Apr 25, 2022

@ianlancetaylor @thanm

HangGa0 added a commit to HangGa0/gofrontend that referenced this issue May 5, 2022
There is a fix for converting unnamed bool to empty interface error.

For reference see this bug in the go git repository:
golang/go#52535
@gopherbot
Copy link

Change https://go.dev/cl/404496 mentions this issue: test: add test that crashed gofrontend

gopherbot pushed a commit that referenced this issue May 6, 2022
For #52535

Change-Id: I6798a8379163497ebebcdadf836b8569735c282b
Reviewed-on: https://go-review.googlesource.com/c/go/+/404496
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
@gopherbot
Copy link

Change https://go.dev/cl/413894 mentions this issue: compiler: use bool for comma-ok if not already boolean

xionghul pushed a commit to xionghul/gcc that referenced this issue Jun 24, 2022
If a comma-ok variable already has a type, and that type is not a
boolean type, then set the type of the temporary variable to bool.
Otherwise we may try to convert an unnamed bool type to an interface
type, which will fail. But we don't want to always use bool, because
the type of the comma-ok variable may be a named bool type, in
which case the assignment would fail (or need an explicit conversion).

The test case is https://go.dev/cl/404496.

Fixes golang/go#52535

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/413894
realqhc pushed a commit to realqhc/gofrontend that referenced this issue Aug 4, 2022
If a comma-ok variable already has a type, and that type is not a
boolean type, then set the type of the temporary variable to bool.
Otherwise we may try to convert an unnamed bool type to an interface
type, which will fail. But we don't want to always use bool, because
the type of the comma-ok variable may be a named bool type, in
which case the assignment would fail (or need an explicit conversion).

The test case is https://go.dev/cl/404496.

Fixes golang/go#52535

Change-Id: I15eb64824952ed8650eb6ae273c1abefb10443e3
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/413894
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
@golang golang locked and limited conversation to collaborators Jun 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants