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
cmd/compile: -d=checkptr doesn't handle reflect.{Slice,String}Header.Data #35027
Comments
Thanks to @wI2L for the report. |
Also, I'll note that @wI2L's report actually involved |
This one:
fails with |
@cuonglm I mean that cmd/compile does safely compile that program, but package unsafe doesn't guarantee it to be safe. So it's okay for that program that to fail with -d=checkptr. |
I see you assigned yourself after I have a fix in my local. Do you want me to send the patch? |
Thanks, but I already have a patch. I just haven't uploaded it yet. |
Change https://golang.org/cl/202560 mentions this issue: |
Change https://golang.org/cl/202558 mentions this issue: |
@mdempsky I cherry picked the two commits (CL 202558 then CL 202560) and applied to clean dev tree and rebuilt to test against my codebase with the change you suggested to convert the EDIT: Just saw you're active on making changes, sorry for the noise, I'll give it another try once you are done. |
@wI2L Hm, that's weird. Can you try at master? I think that should be good. If it's still failing with the extra conversions, can you help me figure out how to reproduce the failure locally so I can investigate? Thanks! |
Nevermind, I can reproduce the failure locally. Investigating. |
These changes make TestCompositeTypes pass under -d=checkptr for me:
There were two issues:
|
Finally,
|
Also, it looks like cmd/vet was already flagging several of these issues:
|
@mdempsky I messed with my dev toolchain at first, I was using an outdated binary. With the latest changes at master and the change you suggested regarding I was aware of the issues reported by vet but I had no idea what was wrong, until I stumbled upon your recent CL, so I gave it another try. Anyway, I appreciate you took some time to help me address these issues with this project as part of your ongoing changes to the toolchain, so thank you. |
Happy to help. Thanks again for the report. |
This program is valid, yet
-d=checkptr
flags it as unsafe pointer arithmetic:This is because I forgot to implement logic to handle rule 6 for -d=checkptr.
The text was updated successfully, but these errors were encountered: