https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106297

            Bug ID: 106297
           Summary: stringop-overflow misbehaviour on atomic
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chipitsine at gmail dot com
  Target Milestone: ---

repro steps

git clone https://github.com/haproxy/haproxy
cd haproxy

export CC=/path/to/gcc
make CC=$CC ERR=1 TARGET=linux-glibc 

error reported:

src/haproxy.c: In function ‘run_poll_loop’:
include/haproxy/atomic.h:428:39: error: ‘__atomic_load_8’ writing 8 bytes into
a region of size 0 overflows the destination [-Werror=stringop-overflow=]
  428 | #define _HA_ATOMIC_LOAD(val)          __atomic_load_n(val,
__ATOMIC_RELAXED)
      |                                      
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/haproxy.c:2843:46: note: in expansion of macro ‘_HA_ATOMIC_LOAD’
 2843 |                                         if
((_HA_ATOMIC_LOAD(&ha_tgroup_ctx[i].stopping_threads) &
ha_tgroup_info[i].threads_enabled) !=
      |                                              ^~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.




error was reviewed by Willy Tarreau in
https://github.com/haproxy/haproxy/issues/1767 and it is considered as false
positive.

I bisected gcc, breaking change is:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=88b504b7a8c5affb0ffa97990d22af2b199e36ed

Reply via email to