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

Bounds check inconsistency in keepat!/deleteat! #54401

Open
sgaure opened this issue May 8, 2024 · 0 comments
Open

Bounds check inconsistency in keepat!/deleteat! #54401

sgaure opened this issue May 8, 2024 · 0 comments
Labels
domain:arrays [a, r, r, a, y, s]

Comments

@sgaure
Copy link

sgaure commented May 8, 2024

It turns out that bounds checking cannot be programmatically elided in deleteat! and keepat!, but it can be elided in keepat! by starting julia with --check-bounds=no.

MWE may lead to undefined behaviour.

arr = [1,2,3,4,5];
badsub = [2,3,6];

keepat!(copy(arr), badsub);
deleteat!(copy(arr), badsub);

@inbounds keepat!(copy(arr), badsub);
@inbounds deleteat!(copy(arr), badsub);

v1.10.3 and master. All four attempts throw with --check-bounds=auto. The two deleteat! also throw with --check-bounds=no. This could potentially be a performance problem.

@Seelengrab Seelengrab added the domain:arrays [a, r, r, a, y, s] label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:arrays [a, r, r, a, y, s]
Projects
None yet
Development

No branches or pull requests

2 participants