public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/112358] New: [14 Regression] glibc -Wstringop-overflow= build failure
@ 2023-11-02 23:25 jsm28 at gcc dot gnu.org
  2023-11-03  8:04 ` [Bug tree-optimization/112358] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2023-11-02 23:25 UTC (permalink / raw)
  To: gcc-bugs

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 <rguenther@suse.de>
AuthorDate: Thu Sep 14 13:06:51 2023 +0200
Commit:     Richard Biener <rguenther@suse.de>
CommitDate: Mon Sep 18 10:56:18 2023 +0200

    tree-optimization/111294 - backwards threader PHI costing

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/112358] [14 Regression] glibc -Wstringop-overflow= build failure
  2023-11-02 23:25 [Bug tree-optimization/112358] New: [14 Regression] glibc -Wstringop-overflow= build failure jsm28 at gcc dot gnu.org
@ 2023-11-03  8:04 ` rguenth at gcc dot gnu.org
  2024-03-07 21:03 ` law at gcc dot gnu.org
  2024-05-07  7:42 ` [Bug tree-optimization/112358] [14/15 " rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-03  8:04 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-11-03

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I've added

cc1: note: destination object is likely at address zero

which indicates that we performed some jump threading that exposes a literal
NULL pointer we diagnose this on.  I see

(gdb) p debug_gimple_stmt (exp)
# .MEM_230 = VDEF <.MEM_252>
__atomic_store_4 (8B, 0, 0);

on the path

...

<bb 13> [local count: 14148527]:
_35 = __atomic_wide_counter_load_relaxed (&_dlfo_loaded_mappings_version); //
dl-find_object.c:260:10
_36 = (int) _35;
active_idx_37 = _36 & 1;
current_seg_38 = _dlfo_loaded_mappings[active_idx_37];
_347 = active_idx_37 ^ 1;
pretmp_348 = _dlfo_loaded_mappings[_347];
if (current_seg_38 != 0B) // dl-find_object.c:137:21
  goto <bb 84>; [94.50%]
else
  goto <bb 72>; [5.50%]

<bb 84> [local count: 13370358]:
goto <bb 23>; [100.00%]

... some loop ...

<bb 24> [local count: 13370358]:
# count_247 = PHI <count_147(93), count_246(95)>
remaining_to_add_43 = count_247 + prephitmp_317; // dl-find_object.c:662:10
if (pretmp_348 != 0B) // dl-find_object.c:150:14
  goto <bb 96>; [89.00%]
else
  goto <bb 27>; [11.00%]

<bb 27> [local count: 1470739]:
if (remaining_to_add_43 != 0) // dl-find_object.c:668:8
  goto <bb 98>; [47.09%]
else
  goto <bb 35>; [52.91%]

<bb 35> [local count: 778169]:
__sync_synchronize ();
__atomic_store_4 (8B, 0, 0); // [dl-find_object.c:644:132
goto <bb 38>; [100.00%]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/112358] [14 Regression] glibc -Wstringop-overflow= build failure
  2023-11-02 23:25 [Bug tree-optimization/112358] New: [14 Regression] glibc -Wstringop-overflow= build failure jsm28 at gcc dot gnu.org
  2023-11-03  8:04 ` [Bug tree-optimization/112358] " rguenth at gcc dot gnu.org
@ 2024-03-07 21:03 ` law at gcc dot gnu.org
  2024-05-07  7:42 ` [Bug tree-optimization/112358] [14/15 " rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-07 21:03 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org
           Priority|P3                          |P2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/112358] [14/15 Regression] glibc -Wstringop-overflow= build failure
  2023-11-02 23:25 [Bug tree-optimization/112358] New: [14 Regression] glibc -Wstringop-overflow= build failure jsm28 at gcc dot gnu.org
  2023-11-03  8:04 ` [Bug tree-optimization/112358] " rguenth at gcc dot gnu.org
  2024-03-07 21:03 ` law at gcc dot gnu.org
@ 2024-05-07  7:42 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-07  7:42 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|14.0                        |14.2

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 14.1 is being released, retargeting bugs to GCC 14.2.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-07  7:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-02 23:25 [Bug tree-optimization/112358] New: [14 Regression] glibc -Wstringop-overflow= build failure jsm28 at gcc dot gnu.org
2023-11-03  8:04 ` [Bug tree-optimization/112358] " rguenth at gcc dot gnu.org
2024-03-07 21:03 ` law at gcc dot gnu.org
2024-05-07  7:42 ` [Bug tree-optimization/112358] [14/15 " rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).