effects: allow concrete-eval when --check-bounds=no
if proven "safe"
#50107
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
From version 1.9 onwards, when
--check-bounds=no
is used, concrete-eval is completely disabled. However, it appears--check-bounds=no
is still being used within the community, causing issues like the one reported in JuliaArrays/StaticArrays.jl#1155. Although we should move forward to a direction of eliminating the flag in the future (#48245), for the time being, there are many requests to carry out a certain level of compiler optimization, even when this flag is enabled.This commit aims to allow concrete-eval "safely" even under
--check-bounds=no
. Specifically, when the method call being analyzed is:nothrow
, it should be predominantly safe to concrete-eval it under this flag. Technically, however, even:nothrow
methods could trigger undefined behavior, since:nothrow
isn't a strict constraint and it's possible for users to annotate potentially risky methods withBase.@assume_effects :nothrow
. Nonetheless, since this possibility is acknowledged inBase.@assume_effects
documentation, I feel it's fair to relegate it to user responsibility.