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
runtime/cgo: fatalf is not declared as "noreturn" #64553
Comments
Which version of clang? |
Latest version still does not have [[noreturn]] : https://github.com/golang/go/blob/master/src/runtime/cgo/libcgo.h#L79 clang version is Ubuntu clang version 14.0.0-1ubuntu1.1 As for gcc_linux_amd64.c |
cc @golang/runtime |
What analysis, specifically, what command did you run and what is the error message? Thanks. |
Error message is in the section "What did you see instead?" of the ticket description. I run the following command:
|
The issue description shows more errors, but that is with go 1.18, which is EOL. This only happens for Go <= 1.21, the changes from CL519457 made the only warning go away. Since this is just a warning I don't think it is worth backporting. $ scan-build go1.21.5 build main.go
scan-build: Using '/usr/lib/llvm-14/bin/clang' for static analysis
# runtime/cgo
gcc_linux_amd64.c:45:2: warning: Null pointer passed to 1st parameter expecting 'nonnull' [core.NonNullParamChecker]
pthread_attr_init(attr);
^~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
scan-build: No bugs found. $ scan-build gotip build main.go
scan-build: Using '/usr/lib/llvm-14/bin/clang' for static analysis
scan-build: No bugs found. |
Thanks @mauri870 . Since there is no more warnings we can close this. If one wants to add a noreturn attribute or dummy return statements after fatalf, feel free to send a CL. Thanks. |
It's ok to close this, however even though go 1.18 is EOL, it is the actual version for Ubuntu 22.04.3 LTS. That is one of the most used distributions. |
Change https://go.dev/cl/550115 mentions this issue: |
Fixes #64553 Change-Id: I7860cd9ba74d70a7d988538ea4df8e122f94cde6 GitHub-Last-Rev: 0616437 GitHub-Pull-Request: #64727 Reviewed-on: https://go-review.googlesource.com/c/go/+/550115 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org> Run-TryBot: Mauri de Souza Meneguzzo <mauri870@gmail.com> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Fixes golang#64553 Change-Id: I7860cd9ba74d70a7d988538ea4df8e122f94cde6 GitHub-Last-Rev: 0616437 GitHub-Pull-Request: golang#64727 Reviewed-on: https://go-review.googlesource.com/c/go/+/550115 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org> Run-TryBot: Mauri de Souza Meneguzzo <mauri870@gmail.com> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Go version
go version go1.18.1 linux/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
Run go build of a cgo project under clang's scan-build for static analysis.
What did you expect to see?
No static analizer errors.
What did you see instead?
In my case /usr/lib/go-1.18/src/runtime/cgo/gcc_linux_amd64.c produces:
this is because fatalf is not declared as [[noreturn]]:
The text was updated successfully, but these errors were encountered: