~lttng/urcu/trunk

  • Committer: Mathieu Desnoyers
  • Date: 2021-06-15 19:43:06 UTC
  • Revision ID: git-v1:835b9ab3ca3777fe42e37e92096226ebd19ca75b
Fix: x86 and s390 uatomic: __hp() macro warning with gcc 11

The __hp() macro used in the x86 and s390 uatomic code generates the
following warning with gcc-11:

In file included from ../include/urcu/uatomic.h:27,
                 from ../include/urcu/static/wfcqueue.h:35,
                 from ../include/urcu/wfcqueue.h:133,
                 from workqueue.c:39:
workqueue.c: In function ‘workqueue_thread’:
../include/urcu/uatomic/x86.h:155:17: warning: array subscript ‘struct __uatomic_dummy[0]’ is partly outside array bounds of ‘struct cds_wfcq_tail[1]’ [-Warray-bounds]
  155 |                 __asm__ __volatile__(
      |                 ^~~~~~~
workqueue.c:184:38: note: while referencing ‘cbs_tmp_tail’
  184 |                 struct cds_wfcq_tail cbs_tmp_tail;
      |                                      ^~~~~~~~~~~~

The (previously undocumented) reason for this macro is to allow passing the
"void *" parameter as "m" or "+m" operand to the inline assembly. That
motivation was explained in commit 53b8ed6836363 ("s390 uatomic arch fix").

The out of bound access is detected by gcc because struct
__uatomic_dummy's length is quite large: an array of 10 unsigned long,
which is larger than the size pointed to by the void pointer.

So rather than using a fixed-size type, cast to a structure containing
an array of characters of a size matching the @addr input argument.

While we are at it and digging out git archeology, properly document the
__hp() macro for posterity.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I785e30661efe48be1806664a1a14fd3c9fdb0a32
Filename Latest Rev Last Changed Committer Comment Size
..
doc 761 12 years ago Mathieu Desnoyers Move API.txt to doc/rcu-api.txt, install in system Diff
extras 1348 3 years ago Mathieu Desnoyers Add serialized ABI definition files This commit c Diff
include 1191 7 years ago Mathieu Desnoyers Cleanup: Re-organise source dir Re-organise the s Diff
m4 1142 8 years ago Mathieu Desnoyers Port: Fixes to build system for portability Move Diff
scripts 908 11 years ago Mathieu Desnoyers Add urcu-api-list.sh script Signed-off-by: Mathie Diff
src 1191 7 years ago Mathieu Desnoyers Cleanup: Re-organise source dir Re-organise the s Diff
tests 234 14 years ago Mathieu Desnoyers Move test programs to tests/ subdir Signed-off-by Diff
.gitignore 1345 3 years ago Mathieu Desnoyers .gitignore: list ignored Makefiles We carry some 4.4 KB Diff Download File
.gitreview 1298 3 years ago Mathieu Desnoyers Add git-review config Add .gitreview for contribu 126 bytes Diff Download File
File bootstrap 1312 3 years ago Mathieu Desnoyers configure: Set autotools baseline Set autotools b 134 bytes Diff Download File
ChangeLog 1350 3 years ago Mathieu Desnoyers Version 0.13.0 Signed-off-by: Mathieu Desnoyers < 38.6 KB Diff Download File
CodingStyle 898 11 years ago Mathieu Desnoyers Spelling cleanups within comments and documentatio 308 bytes Diff Download File
configure.ac 1350 3 years ago Mathieu Desnoyers Version 0.13.0 Signed-off-by: Mathieu Desnoyers < 18.5 KB Diff Download File
gpl-2.0.txt 92 15 years ago Mathieu Desnoyers LGPL relicensing part 2 Rewrote the non-trivial f 17.5 KB Diff Download File
lgpl-2.1.txt 92 15 years ago Mathieu Desnoyers LGPL relicensing part 2 Rewrote the non-trivial f 25.8 KB Diff Download File
lgpl-relicensing.txt 1268 5 years ago Mathieu Desnoyers Update dead link in lgpl-relicensing.txt Signed-o 1 KB Diff Download File
LICENSE 1164 8 years ago Mathieu Desnoyers Support for NIOS2 architecture Add support for th 1.4 KB Diff Download File
Makefile.am 1348 3 years ago Mathieu Desnoyers Add serialized ABI definition files This commit c 486 bytes Diff Download File
README.md 1349 3 years ago Mathieu Desnoyers Document known ABI issue in README.md Signed-off- 15.9 KB Diff Download File