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: llvm-goc crashes when enable-gc is set, with error "gc.statepoint callee argument must have elementtype attribute" #53175

Open
hanchaoqun opened this issue Jun 1, 2022 · 2 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@hanchaoqun
Copy link
Contributor

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

$ go version
go version unknown linux/amd64

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

What did you do?

main.go

package main

import "fmt"

func main() {
        fmt.Println("hello world")
}

compile main.go with llvm-goc -O2 -enable-gc=1 -c main.go command

What did you expect to see?

No error, successful build.

What did you see instead?

hanchaoqun@DESKTOP-EUUIBGL:/mnt/d/golang/gopath/src/helloworld$ llvm-goc -O2 -enable-gc=1 -c main.go
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token = invoke token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8f(i64 0, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*)* @runtime.registerTypeDescriptors, i32 3, i32 0, i8 addrspace(1)* undef, i64 38, i8 addrspace(1)* bitcast ([38 x { i64, [1 x i8 addrspace(1)*] } addrspace(1)*] addrspace(1)* @go..typelists to i8 addrspace(1)*), i32 0, i32 0) [ "deopt"() ]
          to label %.noexc unwind label %dummy, !dbg !96
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token62 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 1, i32 0, void (i8 addrspace(1)*)* @internal_1cpu..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc3 unwind label %dummy1
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token64 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 2, i32 0, void (i8 addrspace(1)*)* @unicode..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc6 unwind label %dummy4
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token66 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 3, i32 0, void (i8 addrspace(1)*)* @math..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc9 unwind label %dummy7
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token68 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 4, i32 0, void (i8 addrspace(1)*)* @runtime..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc12 unwind label %dummy10
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token70 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 5, i32 0, void (i8 addrspace(1)*)* @internal_1reflectlite..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc15 unwind label %dummy13
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token72 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 6, i32 0, void (i8 addrspace(1)*)* @sync..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc18 unwind label %dummy16
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token74 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 7, i32 0, void (i8 addrspace(1)*)* @errors..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc21 unwind label %dummy19
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token76 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 8, i32 0, void (i8 addrspace(1)*)* @sort..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc24 unwind label %dummy22
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token78 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 9, i32 0, void (i8 addrspace(1)*)* @internal_1testlog..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc27 unwind label %dummy25
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token80 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 10, i32 0, void (i8 addrspace(1)*)* @io..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc30 unwind label %dummy28
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token82 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 11, i32 0, void (i8 addrspace(1)*)* @internal_1oserror..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc33 unwind label %dummy31
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token84 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 12, i32 0, void (i8 addrspace(1)*)* @path..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc36 unwind label %dummy34
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token86 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 13, i32 0, void (i8 addrspace(1)*)* @strconv..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc39 unwind label %dummy37
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token88 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 14, i32 0, void (i8 addrspace(1)*)* @reflect..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc42 unwind label %dummy40
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token90 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 15, i32 0, void (i8 addrspace(1)*)* @syscall..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc45 unwind label %dummy43
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token92 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 16, i32 0, void (i8 addrspace(1)*)* @time..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc48 unwind label %dummy46
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token94 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 17, i32 0, void (i8 addrspace(1)*)* @io_1fs..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc51 unwind label %dummy49
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token96 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 18, i32 0, void (i8 addrspace(1)*)* @internal_1poll..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc54 unwind label %dummy52
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token98 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 19, i32 0, void (i8 addrspace(1)*)* @os..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc57 unwind label %dummy55
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token100 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 20, i32 0, void (i8 addrspace(1)*)* @fmt..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc60 unwind label %dummy58
in function __go_init_main
LLVM ERROR: Broken function found, compilation aborted!
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
llvm-goc(+0x332fe7c)[0x55b9c48c7e7c]
llvm-goc(+0x332ff33)[0x55b9c48c7f33]
llvm-goc(+0x332dbe2)[0x55b9c48c5be2]
llvm-goc(+0x332f7fd)[0x55b9c48c77fd]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12980)[0x7f81fd403980]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7f81fc4fbe87]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7f81fc4fd7f1]
llvm-goc(+0x3256a95)[0x55b9c47eea95]
llvm-goc(+0x325688c)[0x55b9c47ee88c]
llvm-goc(+0x30bd1b2)[0x55b9c46551b2]
llvm-goc(+0x2fd7808)[0x55b9c456f808]
llvm-goc(+0x2fd7ab1)[0x55b9c456fab1]
llvm-goc(+0x2fd7ed9)[0x55b9c456fed9]
llvm-goc(+0x2fd2efb)[0x55b9c456aefb]
llvm-goc(+0x2fd8763)[0x55b9c4570763]
llvm-goc(+0x901167)[0x55b9c1e99167]
llvm-goc(+0x8fd7fb)[0x55b9c1e957fb]
llvm-goc(+0x901310)[0x55b9c1e99310]
llvm-goc(+0x8f0a04)[0x55b9c1e88a04]
llvm-goc(+0x8f0bc7)[0x55b9c1e88bc7]
llvm-goc(+0x8e427c)[0x55b9c1e7c27c]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f81fc4dec87]
llvm-goc(+0x8e366a)[0x55b9c1e7b66a]
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llvm-goc -O2 -enable-gc=1 -c main.go
1.      Running pass 'Function Pass Manager' on module 'gomodule'.
2.      Running pass 'Module Verifier' on function '@__go_init_main'
Aborted
@hanchaoqun
Copy link
Contributor Author

Because LLVM introduces an elementtype attribute for statepoint calls to support opaque pointers, see: https://reviews.llvm.org/D117890 and https://reviews.llvm.org/D118886
GoStatepoints.cpp needs to be modified add this attribute for statepoint calls synchronously to avoid verification failures.

CL is comming soon.

@ianlancetaylor ianlancetaylor changed the title gollvm/passes: llvm-goc crashes when enable-gc is set, with error "gc.statepoint callee argument must have elementtype attribute" gollvm: llvm-goc crashes when enable-gc is set, with error "gc.statepoint callee argument must have elementtype attribute" Jun 2, 2022
@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 2, 2022
@ianlancetaylor ianlancetaylor added this to the gollvm milestone Jun 2, 2022
@ianlancetaylor
Copy link
Contributor

CC @thanm @cherrymui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

2 participants