concurrencykit / ck

Concurrency primitives, safe memory reclamation mechanisms and non-blocking (including lock-free) data structures designed to aid in the research, design and implementation of high performance concurrent systems developed in C99+.
http://concurrencykit.org/
Other
2.34k stars 312 forks source link

ck_pr.h causes stringop-overread warning with GCC 11 #185

Closed esproul closed 5 months ago

esproul commented 2 years ago

Witnessed when building a library that consumes libck on Ubuntu 21.10:

In file included from /opt/circonus/include/ck_pr.h:52,
                 from /opt/circonus/include/mtev_hooks.h:45,
                 from ./util/libsnowth_hooks.h:4,
                 from util/libsnowth_hooks.c:1:
/opt/circonus/include/gcc/x86_64/ck_pr.h: In function ‘ck_pr_md_load_char_16’:
/opt/circonus/include/gcc/x86_64/ck_pr.h:228:17: error: ‘ck_pr_load_64_2’ reading 16 bytes from a region of size 2 [-Werror=stringop-overread]
  228 |                 ck_pr_load_64_2((const uint64_t *)(const void *)t,              \
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  229 |                                 (uint64_t *)(void *)v);                         \
      |                                 ~~~~~~~~~~~~~~~~~~~~~~

Seen as recently as 2265c78 on master.

gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0

michael-grunder commented 1 year ago

This doesn't show a bug in libck but rather a potential bug in libsnowth, so I would report it there.

It's also possibly a false positive as this is a newer check in GCC that throws lots of false positives.