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/gollvm/gofrontend: error: argument 1 has incompatible type (invalid use of _) #52871

Closed
tianxiaogu opened this issue May 12, 2022 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@tianxiaogu
Copy link

According to the Go language spec, _ is a letter and thus is a valid parameter identifier, even though the parameter cannot be used. GOLLVM mistakenly uses _ in compiler generated functions, e.g., method thunk. This crash can be reproduced with the trunk (6a33e7e)

package main

func (s *St) test(_ string) {
	println("123")
}

type St struct {}

var ftable = [1]func(*St, string) {
	0: (*St).test,
}

func main() {
	ftable[0](nil, "123")
}
 #0 0x000055b3010c297f PrintStackTraceSignalHandler(void*) (bin/llvm-goc+0x20fc97f)
 #1 0x000055b3010c0b4c SignalHandler(int) (bin/llvm-goc+0x20fab4c)
 #2 0x00007f77c2ddb0e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110e0)
 #3 0x000055b2ff75ff84 Named_method::do_type() const (.localalias.301) (bin/llvm-goc+0x799f84)
 #4 0x000055b2ff762704 Type::get_btype_without_hash(Gogo*) (.localalias.196) (bin/llvm-goc+0x79c704)
 #5 0x000055b2ff77b1e3 Type::get_backend(Gogo*) (.part.1232) (bin/llvm-goc+0x7b51e3)
 #6 0x000055b2ff74f8aa Temporary_statement::do_get_backend(Translate_context*) (.localalias.129) (bin/llvm-goc+0x7898aa)
 #7 0x000055b2ff70af1b Block::get_backend(Translate_context*) (.localalias.84) (bin/llvm-goc+0x744f1b)
 #8 0x000055b2ff74c41d Block_statement::do_get_backend(Translate_context*) (.localalias.166) (bin/llvm-goc+0x78641d)
 #9 0x000055b2ff70af1b Block::get_backend(Translate_context*) (.localalias.84) (bin/llvm-goc+0x744f1b)
#10 0x000055b2ff70bc34 Function::build(Gogo*, Named_object*) (.localalias.97) (bin/llvm-goc+0x745c34)
#11 0x000055b2ff70ddcc Named_object::get_backend(Gogo*, std::vector<Bexpression*, std::allocator<Bexpression*> >&, std::vector<Btype*, std::allocator<Btype*> >&, std::vector<Bfunction*, std::allocator<Bfunction*> >&) (.localalias.30) (bin/llvm-goc+0x747dcc)
#12 0x000055b2ff718fea Gogo::write_globals() (bin/llvm-goc+0x752fea)
#13 0x000055b2ff6ddf28 gollvm::driver::CompileGoImpl::invokeFrontEnd() (.localalias.4) (bin/llvm-goc+0x717f28)
#14 0x000055b2ff6e5eb8 gollvm::driver::CompileGo::performAction(gollvm::driver::Compilation&, gollvm::driver::Action const&, llvm::SmallVector<gollvm::driver::Artifact*, 3u> const&, gollvm::driver::Artifact const&) (.localalias.13) (bin/llvm-goc+0x71feb8)
#15 0x000055b2ff6d72f5 gollvm::driver::Driver::processAction(gollvm::driver::Action*, gollvm::driver::Compilation&, bool) (.localalias.0) (bin/llvm-goc+0x7112f5)
#16 0x000055b2ff6d73ff gollvm::driver::Driver::processActions(gollvm::driver::Compilation&) (bin/llvm-goc+0x7113ff)
#17 0x000055b2ff5fefd1 main (bin/llvm-goc+0x638fd1)
#18 0x00007f77c195e2e1 __libc_start_main /build/glibc-77giwP/glibc-2.24/csu/../csu/libc-start.c:325:0
#19 0x000055b2ff6ce9aa _start (bin/llvm-goc+0x7089aa)
@tianxiaogu tianxiaogu changed the title gollvm/gofrontend: error: argument 1 has incompatible type (invalid use of _) gccgo/gollvm/gofrontend: error: argument 1 has incompatible type (invalid use of _) May 12, 2022
@gopherbot gopherbot added this to the Gccgo milestone May 12, 2022
@heschi
Copy link
Contributor

heschi commented May 13, 2022

cc @thanm

@heschi heschi added the NeedsFix The path to resolution is known, but the work has not been done. label May 13, 2022
@gopherbot
Copy link

Change https://go.dev/cl/414336 mentions this issue: test: add test that caused gofrontend crash

@gopherbot
Copy link

Change https://go.dev/cl/414354 mentions this issue: compiler: don't use sink as parameter in method expression thunk

gopherbot pushed a commit that referenced this issue Jun 27, 2022
For #52871

Change-Id: Id6102222a8b1ec8a84b716425bed0e349c65dbc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/414336
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
xionghul pushed a commit to xionghul/gcc that referenced this issue Jun 27, 2022
Also fix a couple of cases where the error led to a later compiler crash.

Test case is https://go.dev/cl/414336.

Fixes golang/go#52871

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/414354
realqhc pushed a commit to realqhc/gofrontend that referenced this issue Aug 4, 2022
Also fix a couple of cases where the error led to a later compiler crash.

Test case is https://go.dev/cl/414336.

Fixes golang/go#52871

Change-Id: If3a9ecfca20e782c2e827a176f24923c62c48ae8
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/414354
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
For golang#52871

Change-Id: Id6102222a8b1ec8a84b716425bed0e349c65dbc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/414336
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
@golang golang locked and limited conversation to collaborators Jun 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants