Skip to content

[fix] fix ltrim result may incorrect in some case - #7963

Merged
morningman merged 1 commit into
apache:masterfrom
yangzhg:fix_trim
Feb 9, 2022
Merged

[fix] fix ltrim result may incorrect in some case#7963
morningman merged 1 commit into
apache:masterfrom
yangzhg:fix_trim

Conversation

@yangzhg

@yangzhgyangzhg commented Feb 7, 2022

Copy link
Copy Markdown
Member

Problem Summary:

fix ltrim result may incorrect in some case
according to https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
Built-in Function: int __builtin_cl/tz (unsigned int x)
If x is 0, the result is undefined.
So we handle the case of 0 separately

this function return different between gcc and clang when x is 0

Checklist(Required)

  1. Does it affect the original behavior: (Yes)
  2. Has unit tests been added: (Yes)
  3. Has document been added or modified: (No Need)
  4. Does it need to update dependencies: (No)
  5. Are there any changes that cannot be rolled back: (No)

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@xinghuayu007

Copy link
Copy Markdown
Contributor

please add some unit tests for case: __builtin_cl/tz (0)

@amosbird

Copy link
Copy Markdown
Contributor

Similar fixes has been done in #7712 , which was caught by current unit tests. It's an indication that test coverage should be improved.

@yangzhg

Copy link
Copy Markdown
MemberAuthor

please add some unit tests for case: __builtin_cl/tz (0)

Unit test has already contained this situation

@yangzhg

Copy link
Copy Markdown
MemberAuthor

Similar fixes has been done in #7712 , which was caught by current unit tests. It's an indication that test coverage should be improved.

I see, this is in another function, we may merge the those implements together

@xinghuayu007

Copy link
Copy Markdown
Contributor

LGTM

@morningmanmorningman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actionsgithub-actionsBot added the approved Indicates a PR has been approved by one committer. label Feb 8, 2022
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@morningman
morningman merged commit 5029ef4 into apache:masterFeb 9, 2022
@yangzhg
yangzhg deleted the fix_trim branch February 14, 2022 01:48
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@yangzhg@xinghuayu007@amosbird@morningman