-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/tools/go/ssa: Crash when dereferencing an unsafe.Pointer #59872
Comments
That source isn't compileable - you can't dereference an |
Hmm... You're right. That shouldn't even compile and (something) probably should return error. Should I have even been able to get past packages.Load with that bad syntax? It didn't return any error. |
I think the syntax is ok, it just doesn't typecheck. |
It seems to type check, but I missed that it will return those kinds of errors as a slice inside of the struct for each package that package.Load creates. I am now checking for those errors and bombing out before SSA generation occurs. The crash above is still a legit crash unless undefined behavior is to be expected if the code is bad. |
The example given fails to typecheck https://go.dev/play/p/Sw96NfY-pe- This gives the error:
Panicking on code that does not type checking is expected behavior for ssa. (Not quite "undefined", but this is splitting hairs.) Panicking on non-go code is kinda baked into the design of the package and is hard to change.
x/tools/go/sssa assumes type checked packages. Typechecking is done by packages.Load normally. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I attempted to generate SSA from a source file containing the following:
Where _start_bss is some arbitrary pointer value.
What did you expect to see?
I expected it to not crash and emit the proper SSA
What did you see instead?
The text was updated successfully, but these errors were encountered: