[Bug target/113915] [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe

2024-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113915

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |blocker

[Bug target/113915] [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe

2024-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113915

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |14.0

[Bug target/113915] [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe

2024-02-13 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113915

--- Comment #5 from Sam James  ---
(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.

[Bug target/113915] [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe

2024-02-13 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113915

--- Comment #4 from Sam James  ---
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=, loaded=) at
dl-find_object.c:777
777 atomic_store_relaxed (&target_seg->previous->size, 0);
(gdb) bt
#0  _dl_find_object_update_1 (count=, loaded=) 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=0xf7fa,
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 ) 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=, args=0xfffeee78, args@entry=0xfffeee70) at
dl-catch.c:256
#10 0xf7f792c0 in dlerror_run (operate=,
args=args@entry=0xfffeee70) at dl-libc.c:45
#11 0xf7f79538 in __libc_dlopen_mode (name=,
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)
```

[Bug target/113915] [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe

2024-02-13 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113915

--- Comment #3 from Sam James  ---
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)
```

[Bug target/113915] [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe

2024-02-13 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113915

Sam James  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  ---
_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.

[Bug target/113915] [14 regression] glibc miscompiled for armv7a since r14-4365-g0731889c026bfe

2024-02-13 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113915

--- Comment #1 from Sam James  ---
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)
```