-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
@inbounds
in dead code taints consistency
#48243
Comments
On further thought, I'm not sure |
In fact |
Consistency needs to be true for all argument values, since the compiler is allowed to invent them. |
But if we access outside of bounds and into potentially undefined memory, how can the compiler know what to put there? |
The compiler doesn't, we need to prevent trying to concrete eval something that might invoke undefined behavior or in other words, undefined behavior taints :consistent. |
Could we make it so that indexing out of bounds at compile time semantically returned zero? |
If we knew at compile time that were indexing out of bounds we probably want to throw an error at compile time no? |
You'd have to compile a separate copy of all functions, which is unlikely to be worth it. Also in general, you can't really do much with the results, because it's no longer a faithful model of the function being analyzed. |
This works to fix #48243, by only tanting effects if an `@inbounds` statement is actually reached. Further, it refines the `noinbounds` effect to be IPO-cached and used to track whether a particular method read the inbounds state. A `:boundscheck` expression now does not immediately taint consistencty, but instead, taints `noinbounds` only. Then, if a method that has `:noinbounds` tainted is called within an `@inbounds` region, consistency is tainted. Similarly, a tainted `:noinbounds` disables constant propagation at `@inbounds` statements or if the method propagates inbounds.
This works to fix #48243, by only tanting effects if an `@inbounds` statement is actually reached. Further, it refines the `noinbounds` effect to be IPO-cached and used to track whether a particular method read the inbounds state. A `:boundscheck` expression now does not immediately taint consistencty, but instead, taints `noinbounds` only. Then, if a method that has `:noinbounds` tainted is called within an `@inbounds` region, consistency is tainted. Similarly, a tainted `:noinbounds` disables constant propagation at `@inbounds` statements or if the method propagates inbounds.
This works to fix #48243, by only tanting effects if an `@inbounds` statement is actually reached. Further, it refines the `noinbounds` effect to be IPO-cached and used to track whether a particular method read the inbounds state. A `:boundscheck` expression now does not immediately taint consistencty, but instead, taints `noinbounds` only. Then, if a method that has `:noinbounds` tainted is called within an `@inbounds` region, consistency is tainted. Similarly, a tainted `:noinbounds` disables constant propagation at `@inbounds` statements or if the method propagates inbounds.
This works to fix #48243, by only tanting effects if an `@inbounds` statement is actually reached. Further, it refines the `noinbounds` effect to be IPO-cached and used to track whether a particular method read the inbounds state. A `:boundscheck` expression now does not immediately taint consistencty, but instead, taints `noinbounds` only. Then, if a method that has `:noinbounds` tainted is called within an `@inbounds` region, consistency is tainted. Similarly, a tainted `:noinbounds` disables constant propagation at `@inbounds` statements or if the method propagates inbounds.
This works to fix #48243, by only tanting effects if an `@inbounds` statement is actually reached. Further, it refines the `noinbounds` effect to be IPO-cached and used to track whether a particular method read the inbounds state. A `:boundscheck` expression now does not immediately taint consistencty, but instead, taints `noinbounds` only. Then, if a method that has `:noinbounds` tainted is called within an `@inbounds` region, consistency is tainted. Similarly, a tainted `:noinbounds` disables constant propagation at `@inbounds` statements or if the method propagates inbounds. (cherry picked from commit d544e78)
This likely regressed in #48158
The text was updated successfully, but these errors were encountered: