signed/unsigned compare in btree.h

Open Beginner friendly
#771 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
cpp
Domain
compilers

Research direction

The issue points to a signed/unsigned comparison warning in external/abseil/absl/container/internal/btree.h at line 2439. Look at the variable 'max_count' and the constant 'kNodeValues' to determine their types. The fix likely involves casting or changing the type of one to match. Compile the file with sign comparison warnings enabled to verify the fix. Run the relevant tests for the btree container to ensure no regressions.

Written by the indexing model from the issue text.

Description

bug

Describe the bug

Since the enum containing kNodeValues was changed to be explicitly uint32_t, there is now a signed/unsigned comparison:

external/abseil/absl/container/internal/btree.h:2439:19: error: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Werror=sign-compare]
2439 | if (max_count < kNodeValues) {
| ~~~~~~~~~~^~~~~~~~~~~~~

Steps to reproduce the bug

Compile revision c6b3f2cf583d8fec124f9d70a172b513363506fe with sign comparison warnings turned on

What version of Abseil are you using?
HEAD (c6b3f2cf583d8fec124f9d70a172b513363506fe and later)

What operating system and version are you using
Linux (RHEL 6)

What compiler and version are you using?
gcc 9.1.0
clang 8.0.1
clang 9.0.0

What build system are you using?
cmake 3.15.0

Additional context

Dominant language
C++
Stars
18.1k
Forks
3.2k
Avg merge
12h 35m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from abseil/abseil-cpp

All issues in abseil/abseil-cpp

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.