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

add safety for noalias on a parameter #476

Open
andrewrk opened this Issue Sep 14, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@andrewrk
Member

andrewrk commented Sep 14, 2017

When you call a function with pointer arguments marked as noalias, such as @memcpy, it is undefined behavior for the pointer arguments to point to the same memory. We can insert a safety check for this. It should be pretty low cost.

This should work for slices too, and it should ensure that the slices do not overlap. In order for the optimizer to potentially be able to use this information, we should probably pass slices as 2 parameters, the pointer and the length. This way we can add parameter attributes to the pointer parameter.

@andrewrk andrewrk added this to the 0.2.0 milestone Sep 14, 2017

@andrewrk andrewrk modified the milestones: 0.2.0, 0.3.0 Oct 19, 2017

@andrewrk andrewrk modified the milestones: 0.3.0, 0.4.0 Feb 28, 2018

@BarabasGitHub

This comment has been minimized.

Contributor

BarabasGitHub commented Jul 13, 2018

we should probably pass slices as 2 parameters, the pointer and the length. This way we can add parameter attributes to the pointer parameter.

Can't you do a noalias on a slice? Or are slices internally passed by reference currently?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment