[fix](be) Remove pure attribute from assert_cast#63417
Merged
Merged
Conversation
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary: assert_cast may throw doris::Exception when release type checking detects an invalid cast. The function was annotated with PURE even though throwing an exception is an observable side effect and changes control flow. Remove the incorrect PURE annotation so compilers generate normal exception handling for assert_cast failure paths.
### Release note
None
### Check List (For Author)
- Test: Manual test
- git diff --cached --check
- Behavior changed: No
- Does this need documentation: No
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an incorrect compiler optimization contract by removing the PURE attribute from assert_cast, since assert_cast can throw doris::Exception on invalid casts (observable side effect / control-flow change), making __attribute__((pure)) semantically invalid for this function.
Changes:
- Removed the
PUREattribute annotation fromassert_castto avoid incorrect compiler assumptions/optimizations on exception paths.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
/review |
Contributor
Author
|
run buildall |
Contributor
TPC-H: Total hot run time: 31460 ms |
Contributor
TPC-DS: Total hot run time: 169170 ms |
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
Mryange
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary:
assert_castcan throwdoris::Exceptionwhen release type checking detects an invalid cast. The function was annotated withPURE, but throwing an exception is an observable side effect and changes control flow, so the annotation gives the compiler an invalid optimization contract for the failure path. This removes the incorrect annotation and leaves the existing cast logic unchanged.Release note
None
Check List (For Author)
git diff --cached --check