public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "chrisj at rtems dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/105880] New: eh_globals_init destructor not setting _M_init to false Date: Wed, 08 Jun 2022 05:19:25 +0000 [thread overview] Message-ID: <bug-105880-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105880 Bug ID: 105880 Summary: eh_globals_init destructor not setting _M_init to false Product: gcc Version: 12.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: chrisj at rtems dot org Target Milestone: --- RTEMS 6 with GCC 12 (gcc version 12.1.1 20220509 (RTEMS 6, RSB e73a258a3aa4af8735b589a2d770571b2105ac5f, Newlib 64b2081) (GCC)) is calling `std::terminate()` in `__cxa_get_globals()`. The `_M_init` value is `true` after the static destructor has run. RTEMS is tracking the issue with https://devel.rtems.org/ticket/4661. When `exit()` is called the static destructor for `eh_gloabls init` runs and deletes the POSIX key however the `_M_init` variable is not set to false. Later `__cxxabiv1::__cxa_get_globals()` is called and sees `_M_init` is `true` so attempts to get the POSIX key value. This fails because the key has been deleted so `NULL` is returned. Memory is allocated and the set fails because there is no key so `std::terminate()` is called. The issue is `init._M_init` is not set to false in the static destructor. The code for aarch64 and arm is: 006562e0 <__eh_globals_init::~__eh_globals_init()>: 6562e0: 7903 ldrb r3, [r0, #4] 6562e2: b510 push {r4, lr} 6562e4: 4604 mov r4, r0 6562e6: b90b cbnz r3, 6562ec <__eh_globals_init::~__eh_globals_init()+0xc> 6562e8: 4620 mov r0, r4 6562ea: bd10 pop {r4, pc} 6562ec: 6800 ldr r0, [r0, #0] 6562ee: f04d fe6b bl 6a3fc8 <pthread_key_delete> 6562f2: 4620 mov r0, r4 6562f4: bd10 pop {r4, pc} 0000000010222c30 <__eh_globals_init::~__eh_globals_init()>: 10222c30: 39401001 ldrb w1, [x0, #4] 10222c34: 35000041 cbnz w1, 10222c3c <__eh_globals_init::~__eh_globals_init()+0xc> 10222c38: d65f03c0 ret 10222c3c: a9bf7bfd stp x29, x30, [sp, #-16]! 10222c40: 910003fd mov x29, sp return pthread_key_delete (__key); 10222c44: b9400000 ldr w0, [x0] 10222c48: 94008806 bl 10244c60 <pthread_key_delete> 10222c4c: a8c17bfd ldp x29, x30, [sp], #16 10222c50: d65f03c0 ret
next reply other threads:[~2022-06-08 5:19 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-08 5:19 chrisj at rtems dot org [this message] 2022-06-08 5:50 ` [Bug libstdc++/105880] " sebastian.huber@embedded-brains.de 2022-06-08 5:56 ` pinskia at gcc dot gnu.org 2022-06-08 5:58 ` pinskia at gcc dot gnu.org 2022-06-08 6:00 ` chrisj at rtems dot org 2022-06-08 6:04 ` pinskia at gcc dot gnu.org 2022-06-08 6:12 ` chrisj at rtems dot org 2022-06-08 9:00 ` redi at gcc dot gnu.org 2022-06-08 9:19 ` redi at gcc dot gnu.org 2022-06-08 9:49 ` redi at gcc dot gnu.org 2022-06-09 0:19 ` chrisj at rtems dot org 2022-06-09 9:07 ` redi at gcc dot gnu.org 2022-06-10 14:24 ` cvs-commit at gcc dot gnu.org 2022-06-10 14:27 ` redi at gcc dot gnu.org 2022-07-21 7:55 ` cvs-commit at gcc dot gnu.org 2022-07-21 8:58 ` redi at gcc dot gnu.org 2022-11-02 14:14 ` redi at gcc dot gnu.org 2022-11-02 14:55 ` rdiezmail-gcc at yahoo dot de
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-105880-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).