public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe
@ 2024-02-14  2:41 sjames at gcc dot gnu.org
  2024-02-14  2:42 ` [Bug target/113915] " sjames at gcc dot gnu.org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-02-14  2:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113915
           Summary: [14 regression] glibc miscompiled for armv7a since
                    r14-4365-g0731889c026bfe
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
                CC: ramana at gcc dot gnu.org, wilco at gcc dot gnu.org
  Target Milestone: ---

glibc seems to go from 30 failing innocent tests (*) to over 400 between gcc-13
and gcc-14. Bisected to r14-4365-g0731889c026bfe which fixed PR111235.

It's hard to know where to start with this. I'll try the usual bisection of
objects and then pragmas although I fear the (necessary) complexities of
glibc's build system may make my usual method tricky. We'll see...

I've bisected using glibc's posix/tst-getopt-cancel test as it had easy output
to grep for:
```
$ cat ./posix/tst-getopt-cancel.out
begin: no errors
Didn't expect signal from child: got `Segmentation fault'
```

(*) just from sandboxing stuff, they're normally not there and should be
unrelated given they happened w/ 13.

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

* [Bug target/113915] [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
@ 2024-02-14  2:42 ` sjames at gcc dot gnu.org
  2024-02-14  2:48 ` sjames at gcc dot gnu.org
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-02-14  2:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Sam James <sjames at gcc dot gnu.org> ---
glibc's WAIT_FOR_DEBUGGER support for tests seems broken, as it drops me into a
waiting process with:
```
/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-arm-armv7a-unknown-linux-gnueabihf-nptl/posix/tst-getopt-cancel.gdb:6:
Error in sourced command file:
'wait_for_debugger' has unknown type; cast it to its declared type
```

Can't manually set wait_for_debugger either. Whatever. Trying manually, we get
(without very good debugging symbols yet):
```
Thread 2.1 "ld-linux-armhf." received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xf7e33020 (LWP 4162410)]
0xf7fcc524 in _dl_find_object_update () from
/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-arm-armv7a-unknown-linux-gnueabihf-nptl/elf/ld-linux-armhf.so.3
(gdb) bt
#0  0xf7fcc524 in _dl_find_object_update () from
/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-arm-armv7a-unknown-linux-gnueabihf-nptl/elf/ld-linux-armhf.so.3
#1  0xf7fd4320 in dl_open_worker_begin () from
/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-arm-armv7a-unknown-linux-gnueabihf-nptl/elf/ld-linux-armhf.so.3
#2  0xf7fc8f68 in _dl_catch_exception () from
/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-arm-armv7a-unknown-linux-gnueabihf-nptl/elf/ld-linux-armhf.so.3
#3  0xf7fd37c4 in dl_open_worker () from
/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-arm-armv7a-unknown-linux-gnueabihf-nptl/elf/ld-linux-armhf.so.3
#4  0xf7fc8f68 in _dl_catch_exception () from
/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-arm-armv7a-unknown-linux-gnueabihf-nptl/elf/ld-linux-armhf.so.3
#5  0xf7fd3b94 in _dl_open () from
/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-arm-armv7a-unknown-linux-gnueabihf-nptl/elf/ld-linux-armhf.so.3
#6  0xf7f80528 in do_dlopen () from
/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-arm-armv7a-unknown-linux-gnueabihf-nptl/libc.so.6
#7  0xf7fc8f68 in _dl_catch_exception () from
/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-arm-armv7a-unknown-linux-gnueabihf-nptl/elf/ld-linux-armhf.so.3
#8  0xf7fc90c4 in _dl_catch_error () from
/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-arm-armv7a-unknown-linux-gnueabihf-nptl/elf/ld-linux-armhf.so.3
#9  0xf7f8044c in dlerror_run () from
/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-arm-armv7a-unknown-linux-gnueabihf-nptl/libc.so.6
#10 0xf7f80744 in __libc_dlopen_mode () from
/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-arm-armv7a-unknown-linux-gnueabihf-nptl/libc.so.6
#11 0xf7f3601c in __libc_unwind_link_get () from
/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-arm-armv7a-unknown-linux-gnueabihf-nptl/libc.so.6
#12 0xf7eb21a0 in pthread_cancel@GLIBC_2.4 () from
/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-arm-armv7a-unknown-linux-gnueabihf-nptl/libc.so.6
#13 0xf7fc2828 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
```

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

* [Bug target/113915] [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
  2024-02-14  2:42 ` [Bug target/113915] " sjames at gcc dot gnu.org
@ 2024-02-14  2:48 ` sjames at gcc dot gnu.org
  2024-02-14  2:53 ` sjames at gcc dot gnu.org
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-02-14  2:48 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://sourceware.org/bugz
                   |                            |illa/show_bug.cgi?id=28745
                 CC|                            |fw at gcc dot gnu.org

--- Comment #2 from Sam James <sjames at gcc dot gnu.org> ---
_dl_find_object_update uses a bunch of atomics so the bisect result seems
reasonable. It is possible that there's something wrong on the glibc side here,
like in https://sourceware.org/bugzilla/show_bug.cgi?id=28745.

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

* [Bug target/113915] [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
  2024-02-14  2:42 ` [Bug target/113915] " sjames at gcc dot gnu.org
  2024-02-14  2:48 ` sjames at gcc dot gnu.org
@ 2024-02-14  2:53 ` sjames at gcc dot gnu.org
  2024-02-14  3:10 ` sjames at gcc dot gnu.org
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-02-14  2:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Sam James <sjames at gcc dot gnu.org> ---
On glibc trunk (491e55beab7457ed310a4a47496f4a333c5d1032), I can reproduce
with:
```
CC=/tmp/gcc/bin/gcc CXX=/tmp/gcc/bin/g++ ~/git/glibc/configure --prefix=/usr
make -j$(nproc)
make test t=posix/tst-getopt-cancel
```

```
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/armv7a-unknown-linux-gnueabihf/14/lto-wrapper
Target: armv7a-unknown-linux-gnueabihf
Configured with:
/var/tmp/portage/sys-devel/gcc-14.0.1_pre20240204-r1/work/gcc-14-20240204/configure
--host=armv7a-unknown-linux-gnueabihf --build=armv7a-unknown-linux-gnueabihf
--prefix=/usr --bindir=/usr/armv7a-unknown-linux-gnueabihf/gcc-bin/14
--includedir=/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/14/include
--datadir=/usr/share/gcc-data/armv7a-unknown-linux-gnueabihf/14
--mandir=/usr/share/gcc-data/armv7a-unknown-linux-gnueabihf/14/man
--infodir=/usr/share/gcc-data/armv7a-unknown-linux-gnueabihf/14/info
--with-gxx-include-dir=/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/14/include/g++-v14
--disable-silent-rules --disable-dependency-tracking
--with-python-dir=/share/gcc-data/armv7a-unknown-linux-gnueabihf/14/python
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--disable-libunwind-exceptions --enable-checking=yes,extra
--with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo
14.0.1_pre20240204-r1 p20' --with-gcc-major-version-only
--enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--disable-multilib --disable-fixed-point --with-float=hard --with-arch=armv7-a
--with-float=hard --with-fpu=vfpv3-d16 --enable-libgomp --disable-libssp
--disable-libada --disable-cet --disable-systemtap
--disable-valgrind-annotations --disable-vtable-verify --disable-libvtv
--without-zstd --without-isl --enable-default-pie --enable-host-pie
--disable-host-bind-now --enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.1 20240204 (experimental) (Gentoo 14.0.1_pre20240204-r1 p20)
```

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

* [Bug target/113915] [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-02-14  2:53 ` sjames at gcc dot gnu.org
@ 2024-02-14  3:10 ` sjames at gcc dot gnu.org
  2024-02-14  3:14 ` sjames at gcc dot gnu.org
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-02-14  3:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Sam James <sjames at gcc dot gnu.org> ---
better bt:
```
begin: no errors
[New LWP 250625]

Thread 2.1 "ld-linux-armhf." received signal SIGSEGV, Segmentation fault.
[Switching to LWP 250624]
_dl_find_object_update_1 (count=<optimized out>, loaded=<optimized out>) at
dl-find_object.c:777
777         atomic_store_relaxed (&target_seg->previous->size, 0);
(gdb) bt
#0  _dl_find_object_update_1 (count=<optimized out>, loaded=<optimized out>) at
dl-find_object.c:777
#1  _dl_find_object_update (new_map=new_map@entry=0xf7fbc158) at
dl-find_object.c:805
#2  0xf7fd3650 in dl_open_worker_begin (a=0xfffeec20) at dl-open.c:756
#3  0xf7fc7f54 in __GI__dl_catch_exception (exception=0xf7fa0000,
exception@entry=0xfffeea30, operate=0xf7fc7f54 <__GI__dl_catch_exception+112>,
args=0xfffeea38, args@entry=0xfffeec20)
    at dl-catch.c:237
#4  0xf7fd2a78 in dl_open_worker (a=0xfffeec20) at dl-open.c:803
#5  0xf7fc7f54 in __GI__dl_catch_exception (exception=0xf7f2902c
<__GI___libc_unwind_link_get+76>, exception@entry=0xfffeec14,
operate=0xf7fc7f54 <__GI__dl_catch_exception+112>,
    args=0xfffeec14, args@entry=0xfffeec18) at dl-catch.c:237
#6  0xf7fd2e5c in _dl_open (file=0xf7f983a0 "libgcc_s.so.1", mode=-2147483646,
caller_dlopen=0xf7f2902c <__GI___libc_unwind_link_get+76>, nsid=nsid@entry=-2,
argc=1, argv=0xfffef1b4,
    env=0xfffef1bc) at dl-open.c:905
#7  0xf7f79364 in do_dlopen (ptr=0xfffeee78) at dl-libc.c:95
#8  0xf7fc7f54 in __GI__dl_catch_exception (exception=0xfffeee64,
exception@entry=0xfffeee2c, operate=0xf7fc7f54 <__GI__dl_catch_exception+112>,
args=0xfffeee34,
    args@entry=0xf7fa411c <global>) at dl-catch.c:237
#9  0xf7fc80b0 in _dl_catch_error (objname=0xfffeee60,
objname@entry=0xfffeee58, errstring=0xfffeee64, errstring@entry=0xfffeee5c,
mallocedp=0xfffeee5f, mallocedp@entry=0xfffeee57,
    operate=<optimized out>, args=0xfffeee78, args@entry=0xfffeee70) at
dl-catch.c:256
#10 0xf7f792c0 in dlerror_run (operate=<optimized out>,
args=args@entry=0xfffeee70) at dl-libc.c:45
#11 0xf7f79538 in __libc_dlopen_mode (name=<optimized out>,
mode=mode@entry=-2147483646) at dl-libc.c:162
#12 0xf7f2902c in __GI___libc_unwind_link_get () at unwind-link.c:51
#13 0xf7eb3300 in __pthread_cancel (th=4158874656) at pthread_cancel.c:99
#14 0xf7fc1468 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
```

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

* [Bug target/113915] [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-02-14  3:10 ` sjames at gcc dot gnu.org
@ 2024-02-14  3:14 ` sjames at gcc dot gnu.org
  2024-02-14  6:59 ` pinskia at gcc dot gnu.org
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-02-14  3:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Sam James from comment #0)
> glibc seems to go from 30 failing innocent tests (*) to over 400 between
> gcc-13 and gcc-14. Bisected to r14-4365-g0731889c026bfe which fixed PR111235.
> 
> It's hard to know where to start with this. I'll try the usual bisection of
> objects and then pragmas although I fear the (necessary) complexities of
> glibc's build system may make my usual method tricky. We'll see...
> 

Indeed, optimize("O0") pragma for _dl_find_object_update_1 in
dl-find_object.c/o avoids the crash. O1/O2 fail.

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

* [Bug target/113915] [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-02-14  3:14 ` sjames at gcc dot gnu.org
@ 2024-02-14  6:59 ` pinskia at gcc dot gnu.org
  2024-02-14  6:59 ` pinskia at gcc dot gnu.org
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-14  6:59 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

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

* [Bug target/113915] [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-02-14  6:59 ` pinskia at gcc dot gnu.org
@ 2024-02-14  6:59 ` pinskia at gcc dot gnu.org
  2024-02-14  7:05 ` [Bug target/113915] [14 regression] glibc's _dl_find_object_update_1 " pinskia at gcc dot gnu.org
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-14  6:59 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |blocker

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

* [Bug target/113915] [14 regression] glibc's _dl_find_object_update_1 miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-02-14  6:59 ` pinskia at gcc dot gnu.org
@ 2024-02-14  7:05 ` pinskia at gcc dot gnu.org
  2024-02-14  7:16 ` pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-14  7:05 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-02-14
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
```
[[gnu::noipa]]
void f(int *a)
{
  if (a)
  __atomic_store_n (a, 0, __ATOMIC_RELAXED);
}

void main()
{
  f((int*)0);
}
```

Trunk produces:
```
        cmp     r0, #0
        movne   r3, #0
        str     r3, [r0]
        bx      lr
```

Which is totally wrong.

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

* [Bug target/113915] [14 regression] glibc's _dl_find_object_update_1 miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-02-14  7:05 ` [Bug target/113915] [14 regression] glibc's _dl_find_object_update_1 " pinskia at gcc dot gnu.org
@ 2024-02-14  7:16 ` pinskia at gcc dot gnu.org
  2024-02-14  7:21 ` pinskia at gcc dot gnu.org
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-14  7:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Seems like the code in arm_final_prescan_insn does not realize arm_atomic_store
cannot be conditional.

That is:
```
(insn 10 9 11 (set (mem/v:SI (reg/v/f:SI 0 r0 [orig:116 aD.6109 ] [116]) [-1 
S4 A32])
        (unspec_volatile:SI [
                (reg:SI 3 r3 [117])
            ] VUNSPEC_STR)) "/app/example.cpp":5:3 3064 {arm_atomic_storesi}
     (expr_list:REG_DEAD (reg:SI 3 r3 [117])
        (expr_list:REG_DEAD (reg/v/f:SI 0 r0 [orig:116 aD.6109 ] [116])
            (nil))))
```
cannot be conditional executed.

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

* [Bug target/113915] [14 regression] glibc's _dl_find_object_update_1 miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2024-02-14  7:16 ` pinskia at gcc dot gnu.org
@ 2024-02-14  7:21 ` pinskia at gcc dot gnu.org
  2024-02-14  7:26 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-14  7:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #7)
> cannot be conditional executed.

That is because most of the insn patterns in sync.md don't have 
  [(set_attr "conds" "nocond")])

on them ....

Someone will have to submit that patch after testing, I don't have the
bandwidth to do it though.

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

* [Bug target/113915] [14 regression] glibc's _dl_find_object_update_1 miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2024-02-14  7:21 ` pinskia at gcc dot gnu.org
@ 2024-02-14  7:26 ` pinskia at gcc dot gnu.org
  2024-02-14  7:38 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-14  7:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #8)
> (In reply to Andrew Pinski from comment #7)
> > cannot be conditional executed.
> 
> That is because most of the insn patterns in sync.md don't have 
>   [(set_attr "conds" "nocond")])
> 
> on them ....
> 
> Someone will have to submit that patch after testing, I don't have the
> bandwidth to do it though.

Actually wait that is the not fix.

This should work, I think:
```
diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc
index c44047c377a..d55ea59a727 100644
--- a/gcc/config/arm/arm.cc
+++ b/gcc/config/arm/arm.cc
@@ -25611,11 +25611,12 @@ arm_final_prescan_insn (rtx_insn *insn)

            case INSN:
              /* Instructions using or affecting the condition codes make it
-                fail.  */
+                fail or ones which cannot be predicable.  */
              scanbody = PATTERN (this_insn);
              if (!(GET_CODE (scanbody) == SET
                    || GET_CODE (scanbody) == PARALLEL)
-                 || get_attr_conds (this_insn) != CONDS_NOCOND)
+                 || get_attr_conds (this_insn) != CONDS_NOCOND
+                 || get_attr_predicable (this_insn) != PREDICABLE_YES)
                fail = TRUE;
              break;

```

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

* [Bug target/113915] [14 regression] glibc's _dl_find_object_update_1 miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2024-02-14  7:26 ` pinskia at gcc dot gnu.org
@ 2024-02-14  7:38 ` pinskia at gcc dot gnu.org
  2024-02-14 10:07 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-14  7:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #9)
> This should work, I think:
With that I get on the reduced testcase:
```
f:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        @ link register save eliminated.
        cmp     r0, #0
        bxeq    lr
        mov     r3, #0
        str     r3, [r0]
        bx      lr

```
Which looks 100% correct now.

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

* [Bug target/113915] [14 regression] glibc's _dl_find_object_update_1 miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2024-02-14  7:38 ` pinskia at gcc dot gnu.org
@ 2024-02-14 10:07 ` rguenth at gcc dot gnu.org
  2024-02-14 11:01 ` wilco at gcc dot gnu.org
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-02-14 10:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

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

* [Bug target/113915] [14 regression] glibc's _dl_find_object_update_1 miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2024-02-14 10:07 ` rguenth at gcc dot gnu.org
@ 2024-02-14 11:01 ` wilco at gcc dot gnu.org
  2024-02-18  9:32 ` sjames at gcc dot gnu.org
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: wilco at gcc dot gnu.org @ 2024-02-14 11:01 UTC (permalink / raw)
  To: gcc-bugs

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

Wilco <wilco at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |wilco at gcc dot gnu.org

--- Comment #11 from Wilco <wilco at gcc dot gnu.org> ---
Yes the default for "conds" attribute is incorrect and at odds with the
"predicable" attribute. The fix should work but will disable conditional
execution on a few ARM-only patterns that just have "conds" attribute. Any
shared patterns will be OK since they already need to set "predicable" for
Thumb-2.

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

* [Bug target/113915] [14 regression] glibc's _dl_find_object_update_1 miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  2024-02-14 11:01 ` wilco at gcc dot gnu.org
@ 2024-02-18  9:32 ` sjames at gcc dot gnu.org
  2024-02-21 14:38 ` wilco at gcc dot gnu.org
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-02-18  9:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #9)
> This should work, I think:
> [...]

I'm going to apply this tonight for our arm builds downstream as we can't do
any testing right now and there's a lot of bugs I'm hitting which look like
they could be dupes of this.

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

* [Bug target/113915] [14 regression] glibc's _dl_find_object_update_1 miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
                   ` (14 preceding siblings ...)
  2024-02-18  9:32 ` sjames at gcc dot gnu.org
@ 2024-02-21 14:38 ` wilco at gcc dot gnu.org
  2024-03-06 17:42 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: wilco at gcc dot gnu.org @ 2024-02-21 14:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Wilco <wilco at gcc dot gnu.org> ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2024-February/646189.html

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

* [Bug target/113915] [14 regression] glibc's _dl_find_object_update_1 miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
                   ` (15 preceding siblings ...)
  2024-02-21 14:38 ` wilco at gcc dot gnu.org
@ 2024-03-06 17:42 ` cvs-commit at gcc dot gnu.org
  2024-03-06 18:00 ` wilco at gcc dot gnu.org
  2024-03-08 15:05 ` cvs-commit at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-06 17:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Wilco Dijkstra <wilco@gcc.gnu.org>:

https://gcc.gnu.org/g:b575f37a342cebb954aa85fa45df0604bfa1ada9

commit r14-9343-gb575f37a342cebb954aa85fa45df0604bfa1ada9
Author: Wilco Dijkstra <wilco.dijkstra@arm.com>
Date:   Wed Mar 6 17:35:16 2024 +0000

    ARM: Fix conditional execution [PR113915]

    By default most patterns can be conditionalized on Arm targets.  However
    Thumb-2 predication requires the "predicable" attribute be explicitly
    set to "yes".  Most patterns are shared between Arm and Thumb(-2) and are
    marked with "predicable".  Given this sharing, it does not make sense to
    use a different default for Arm.  So only consider conditional execution
    of instructions that have the predicable attribute set to yes.  This
ensures
    that patterns not explicitly marked as such are never conditionally
executed.

    gcc/ChangeLog:
            PR target/113915
            * config/arm/arm.md (NOCOND): Improve comment.
            (arm_rev*) Add predicable.
            * config/arm/arm.cc (arm_final_prescan_insn): Add check for
            PREDICABLE_YES.

    gcc/testsuite/ChangeLog:
            PR target/113915
            * gcc.target/arm/builtin-bswap-1.c: Fix test to allow conditional
            execution both for Arm and Thumb-2.

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

* [Bug target/113915] [14 regression] glibc's _dl_find_object_update_1 miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
                   ` (16 preceding siblings ...)
  2024-03-06 17:42 ` cvs-commit at gcc dot gnu.org
@ 2024-03-06 18:00 ` wilco at gcc dot gnu.org
  2024-03-08 15:05 ` cvs-commit at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: wilco at gcc dot gnu.org @ 2024-03-06 18:00 UTC (permalink / raw)
  To: gcc-bugs

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

Wilco <wilco at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #15 from Wilco <wilco at gcc dot gnu.org> ---
Fixed on trunk.

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

* [Bug target/113915] [14 regression] glibc's _dl_find_object_update_1 miscompiled for armv7a since r14-4365-g0731889c026bfe
  2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
                   ` (17 preceding siblings ...)
  2024-03-06 18:00 ` wilco at gcc dot gnu.org
@ 2024-03-08 15:05 ` cvs-commit at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-08 15:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Wilco Dijkstra <wilco@gcc.gnu.org>:

https://gcc.gnu.org/g:5119c7927c70b02ab9768b30f40564480f556432

commit r14-9394-g5119c7927c70b02ab9768b30f40564480f556432
Author: Wilco Dijkstra <wilco.dijkstra@arm.com>
Date:   Fri Mar 8 15:01:15 2024 +0000

    ARM: Fix builtin-bswap-1.c test [PR113915]

    On Thumb-2 the use of CBZ blocks conditional execution, so change the
    test to compare with a non-zero value.

    gcc/testsuite/ChangeLog:
            PR target/113915
            * gcc.target/arm/builtin-bswap.x: Fix test to avoid emitting CBZ.

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

end of thread, other threads:[~2024-03-08 15:05 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-14  2:41 [Bug target/113915] New: [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe sjames at gcc dot gnu.org
2024-02-14  2:42 ` [Bug target/113915] " sjames at gcc dot gnu.org
2024-02-14  2:48 ` sjames at gcc dot gnu.org
2024-02-14  2:53 ` sjames at gcc dot gnu.org
2024-02-14  3:10 ` sjames at gcc dot gnu.org
2024-02-14  3:14 ` sjames at gcc dot gnu.org
2024-02-14  6:59 ` pinskia at gcc dot gnu.org
2024-02-14  6:59 ` pinskia at gcc dot gnu.org
2024-02-14  7:05 ` [Bug target/113915] [14 regression] glibc's _dl_find_object_update_1 " pinskia at gcc dot gnu.org
2024-02-14  7:16 ` pinskia at gcc dot gnu.org
2024-02-14  7:21 ` pinskia at gcc dot gnu.org
2024-02-14  7:26 ` pinskia at gcc dot gnu.org
2024-02-14  7:38 ` pinskia at gcc dot gnu.org
2024-02-14 10:07 ` rguenth at gcc dot gnu.org
2024-02-14 11:01 ` wilco at gcc dot gnu.org
2024-02-18  9:32 ` sjames at gcc dot gnu.org
2024-02-21 14:38 ` wilco at gcc dot gnu.org
2024-03-06 17:42 ` cvs-commit at gcc dot gnu.org
2024-03-06 18:00 ` wilco at gcc dot gnu.org
2024-03-08 15:05 ` cvs-commit 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).