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

GCC 10 gives -Wabsolute-value warning on hat-trie.c indicating signedness bug #38

Open
mjakubicek opened this issue Jun 26, 2022 · 0 comments

Comments

@mjakubicek
Copy link

hat-trie.c: In function ‘hattrie_split’:
hat-trie.c:284:18: warning: taking the absolute value of unsigned type ‘unsigned int’ has no effect [-Wabsolute-value]
  284 |         if (d <= abs(left_m - right_m) && left_m + cs[j + 1] < all_m) {
      |                  ^~~

The expression left_m - right_m likely doesn't work as expected -- it may never be negative because of the unsigned operand types, so the abs has no effect and the operational logic (distance between left_m and right_m) doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant