Guest User

Clang analyzer warning for modulo and size_t

a guest
Apr 7th, 2021
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.19 KB | None | 0 0
  1. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:38:62: warning: The result of the '' expression is undefined [clang-analyzer-core.UndefinedBinaryOperatorResult]
  2.     return ht->num_buckets > 0 ? (ht->hash_fn(key, ht->seed) % ht->num_buckets)
  3.                                                              ^
  4. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:264:9: note: Assuming 'key' is non-null
  5.     if (!key || !ht) {
  6.         ^
  7. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:264:9: note: Left side of '||' is false
  8. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:264:17: note: Assuming 'ht' is non-null
  9.     if (!key || !ht) {
  10.                 ^
  11. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:264:5: note: Taking false branch
  12.     if (!key || !ht) {
  13.     ^
  14. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:269:12: note: Calling 'htable_add_to_bucket'
  15.     return htable_add_to_bucket(ht, key, value, false);
  16.            ^
  17. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:45:10: note: 'ht' is non-null
  18.     if (!ht || !key) {
  19.          ^
  20. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:45:9: note: Left side of '||' is false
  21.     if (!ht || !key) {
  22.         ^
  23. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:45:17: note: 'key' is non-null
  24.     if (!ht || !key) {
  25.                 ^
  26. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:45:5: note: Taking false branch
  27.     if (!ht || !key) {
  28.     ^
  29. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:49:18: note: Calling 'htable_bucket_idx'
  30.     size_t idx = htable_bucket_idx(ht, key);
  31.                  ^
  32. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:34:10: note: 'ht' is non-null
  33.     if (!ht || !key) {
  34.          ^
  35. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:34:9: note: Left side of '||' is false
  36.     if (!ht || !key) {
  37.         ^
  38. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:34:17: note: 'key' is non-null
  39.     if (!ht || !key) {
  40.                 ^
  41. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:34:5: note: Taking false branch
  42.     if (!ht || !key) {
  43.     ^
  44. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:38:16: note: Field 'num_buckets' is > 0
  45.     return ht->num_buckets > 0 ? (ht->hash_fn(key, ht->seed) % ht->num_buckets)
  46.                ^
  47. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:38:12: note: '?' condition is true
  48.     return ht->num_buckets > 0 ? (ht->hash_fn(key, ht->seed) % ht->num_buckets)
  49.            ^
  50. /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c:38:62: note: The result of the '' expression is undefined
  51.     return ht->num_buckets > 0 ? (ht->hash_fn(key, ht->seed) % ht->num_buckets)
  52.                                                              ^
  53. Checking /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c ...
  54. Checking /home/someusername/bwsync/workspace/uni/master/src/data-struct/htable.c: THREADS=4/2...
Advertisement
Add Comment
Please, Sign In to add comment