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

            Bug ID: 112358
           Summary: [14 Regression] glibc -Wstringop-overflow= build
                    failure
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jsm28 at gcc dot gnu.org
                CC: rguenth at gcc dot gnu.org
  Target Milestone: ---
            Target: hppa-linux-gnu

Created attachment 56497
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56497&action=edit
preprocessed source

Building glibc for hppa-linux-gnu has been failing since 18 September:

In file included from ../include/atomic.h:49,
                 from dl-find_object.c:20:
In function '_dlfo_update_init_seg',
    inlined from '_dl_find_object_update_1' at dl-find_object.c:689:30,
    inlined from '_dl_find_object_update' at dl-find_object.c:805:13:
../sysdeps/unix/sysv/linux/hppa/atomic-machine.h:44:4: error:
'__atomic_store_4' writing 4 bytes into a region of size 0 overflows the
destination [-Werror=stringop-overflow=]
   44 |    __atomic_store_n ((mem), (val), __ATOMIC_RELAXED);                  
     \
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dl-find_object.c:644:3: note: in expansion of macro 'atomic_store_relaxed'
  644 |   atomic_store_relaxed (&seg->size, new_seg_size);
      |   ^~~~~~~~~~~~~~~~~~~~
In function '_dl_find_object_update':
cc1: note: destination object is likely at address zero

Compile the attached test with -O2 -Wall:

In function '_dlfo_update_init_seg',
    inlined from '_dl_find_object_update_1' at dl-find_object.c:689:30,
    inlined from '_dl_find_object_update' at dl-find_object.c:805:12:
dl-find_object.c:644:132: warning: '__atomic_store_4' writing 4 bytes into a
region of size 0 overflows the destination [-Wstringop-overflow=]
In function '_dl_find_object_update':
cc1: note: destination object is likely at address zero

I don't know why the compiler thinks "destination object is likely at address
zero", so maybe there is actually an issue in the glibc sources, but I didn't
see an obvious reason for the warning/error.

Introduced by the commit:

commit d45ddc2c04e471d0dcee016b6edacc00b8341b16
Author:     Richard Biener <rguent...@suse.de>
AuthorDate: Thu Sep 14 13:06:51 2023 +0200
Commit:     Richard Biener <rguent...@suse.de>
CommitDate: Mon Sep 18 10:56:18 2023 +0200

    tree-optimization/111294 - backwards threader PHI costing

Reply via email to