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

            Bug ID: 110956
           Summary: gcc_assert is hit at
                    gcc-13.2.0/libgcc/unwind-dw2-fde.c#L291 with some
                    special library
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sumbera at volny dot cz
  Target Milestone: ---

Following test code on Solaris 11.4 i386 seems to get assertion at:

https://github.com/gcc-mirror/gcc/blob/releases/gcc-13.2.0/libgcc/unwind-dw2-fde.c#L291

$ cat test.c

#include <dlfcn.h>
#include <link.h>
#include <unistd.h>
#include <stdio.h>

int main(int argc, char *argv[]) {
        void *hdl;

        if (argc != 2) {
                return 1;
        }

        printf("Open %s\n", argv[1]);
        hdl = dlopen(argv[1], RTLD_NOW);
        printf("hdl=%p\n", hdl);

        if (hdl) {
                dlclose(hdl);
        } else {
        printf("Error: %s\n", dlerror());
        }
        printf("Closed\n");
        return 0;
}

$ gcc -g -m32 -pthreads -D_GNU_SOURCE test.c
$ ./a.out /usr/lib/ssm/lib/libstorelibir-2.so
Open /usr/lib/ssm/lib/libstorelibir-2.so
hdl=fe6ec2a0
Abort (core dumped)

$ mdb core
Loading modules: [ libc.so.1 libsysevent.so.1 libnvpair.so.1 libuutil.so.1
libcmdutils.so.1 libavl.so.1 ld.so.1 ]
a.out:core> $C
feffe6ac libc_hwcap1.so.1`__lwp_sigqueue+0x15(1, 6, feffe6cc, fe19d9b6)
feffe6cc libc_hwcap1.so.1`raise+0x22((int) 6)
feffe71c libc_hwcap1.so.1`abort+0xf4()
feffe78c libgcc_s.so.1`_Unwind_Find_FDE.cold(fd877404, fd876974, feffe7ac,
fd8153f7)
feffe7ac 0xfd81541c(fe6ee950, feffe7f8, fe6b268a, fe593718, 0, fe6eb2a8)
feffe7b8 libstorelibir-2.so.20.10-0`_fini+0x15(fe593718, 0, fe6eb2a8, fe6e5850,
fe6ee0f8, fe6ee294)
feffe7f8 ld.so.1`call_fini+0x10a((Lm_list *) ld.so.1`lml_main, (Rt_map **)
0xfe593560, (Rt_map *) 0xfe6e5850)
feffe888 ld.so.1`_remove_hdl+0x7eb((Rt_map *) 0xfe6e5850, (APlist **)
0xfeffe8a8, (APlist **) 0xfeffe8ac, (Boolean) 1 (TRUE))
feffe8c8 ld.so.1`remove_hdl+0x48((Grp_hdl *) 0xfe6ec2a0, (Rt_map *) 0xfe6e5850)
feffe8e8 ld.so.1`dlclose_core+0xc5((Grp_hdl *) 0xfe6ec2a0, (Rt_map *)
0xfe6e5850, (Lm_list *) ld.so.1`lml_main)
feffe928 ld.so.1`dlclose_intn+0x28((Grp_hdl *) 0xfe6ec2a0, (Rt_map *)
0xfe6e5850)
feffe978 ld.so.1`dlclose_check+0x92((void *) 0xfe6ec2a0, (Rt_map *) 0xfe6e5850)
feffe9b8 ld.so.1`dlclose+0x46((void *) 0xfe6ec2a0)
feffe9e8 main+0x79(feffeaac, feffea04, 8050c3d)
feffea2c _start+0x46(2, feffeb2e, feffeb36, 0, feffeb5a, feffeb6a)

--

Notes:

- This can be seen with both libgcc from GCC 13.1 and 13.2. But not with libgcc
from GCC 12.2
- libstorelibir-2.so is some Solaris specific library. When used with other
libraries there is no problem
- problem cannot be reproduced on Solaris SPARC

Reply via email to