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

Fix -Werror=type-limits. #15635

Merged
merged 2 commits into from
May 2, 2024

Conversation

bdice
Copy link
Contributor

@bdice bdice commented May 1, 2024

Description

I'm compiling cuDF as a part of another application and ran into errors from -Werror=type-limits. There are a few comparisons between unsigned types like value < 0, which is never true. This PR removes those impossible code paths.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@bdice bdice requested a review from a team as a code owner May 1, 2024 22:38
@bdice bdice requested review from mythrocks and nvdbaranec May 1, 2024 22:38
@github-actions github-actions bot added the libcudf Affects libcudf (C++/CUDA) code. label May 1, 2024
@bdice
Copy link
Contributor Author

bdice commented May 1, 2024

I'm not sure how to enforce -Werror=type-limits and would appreciate guidance if that is something we can do in all libcudf builds.

@bdice bdice self-assigned this May 1, 2024
@bdice bdice added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels May 1, 2024
Copy link
Contributor

@mythrocks mythrocks left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -221,7 +221,7 @@ int32_t bz2_decompress_block(unbz_state_s* s)
if (getbits(s, 1)) return BZ_DATA_ERROR; // blockRandomized not supported (old bzip versions)

s->origPtr = getbits(s, 24);
if (s->origPtr < 0 || s->origPtr > 10 + 100000 * s->blockSize100k) return BZ_DATA_ERROR;
if (s->origPtr > 10 + 100000 * s->blockSize100k) return BZ_DATA_ERROR;
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 One wonders how we got here in the first place.

@bdice
Copy link
Contributor Author

bdice commented May 2, 2024

/merge

@rapids-bot rapids-bot bot merged commit e3ea523 into rapidsai:branch-24.06 May 2, 2024
70 checks passed
@vyasr
Copy link
Contributor

vyasr commented May 3, 2024

I'm not sure how to enforce -Werror=type-limits and would appreciate guidance if that is something we can do in all libcudf builds.

Maybe I'm misunderstanding the problem, but could we just add this flag to our builds? We can add flags like this here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants