public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aaron at aarongraham dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/63829] New: Crash in__tls_init when -mcpu=arm1176jzf-s is used
Date: Wed, 12 Nov 2014 01:27:00 -0000	[thread overview]
Message-ID: <bug-63829-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 63829
           Summary: Crash in__tls_init when -mcpu=arm1176jzf-s is used
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aaron at aarongraham dot com

ARM processor, Raspberry Pi

Offending code:

  #include <memory>
  thread_local std::unique_ptr<int> tls_test;

  struct foo {
    foo() { tls_test.reset(new int(42)); }
  } const foo_instance;

  int main() {}

The following works:
g++ test.cc -std=c++14

The following crashes:
g++ test.cc -std=c++14 -mcpu=arm1176jzf-s

I will attach the full disassembly for both.

Here's the basic gdb output:
Core was generated by `./a.out'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00008668 in __tls_init ()
(gdb) bt
#0  0x00008668 in __tls_init ()
#1  0x00008a14 in TLS wrapper function for tls_test ()
#2  0x000086ec in foo::foo() ()
#3  0x00008648 in __static_initialization_and_destruction_0(int, int) ()
#4  0x000086d0 in _GLOBAL__sub_I_tls_test ()
#5  0x00008a78 in __libc_csu_init ()
#6  0x4f508f18 in __libc_start_main ()
   from /opt/armtools/20141030/arm-brcm-linux-gnueabi/sysroot/lib/libc.so.6
#7  0x000084fc in _start ()
(gdb) info reg
r0             0x10da0  69024
r1             0xffff   65535
r2             0xc      12
r3             0x0      0
r4             0x2      2
r5             0x10c64  68708
r6             0x2      2
r7             0x1      1
r8             0xafb35654       2947765844
r9             0xafb3565c       2947765852
r10            0x4f3a7000       1329229824
r11            0xafb354ac       2947765420
r12            0xffff0fff       4294905855
sp             0xafb354a8       0xafb354a8
lr             0x8a14   35348
pc             0x8668   0x8668 <__tls_init+16>
cpsr           0x60000010       1610612752
(gdb)


             reply	other threads:[~2014-11-12  1:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-12  1:27 aaron at aarongraham dot com [this message]
2014-11-12  1:27 ` [Bug c++/63829] " aaron at aarongraham dot com
2014-11-12  1:28 ` aaron at aarongraham dot com
2014-12-06  1:40 ` [Bug libstdc++/63829] _Lock_policy used in thread.cc can cause incompatibilities with binaries using different -mcpu aaron at aarongraham dot com
2014-12-06 16:35 ` redi at gcc dot gnu.org
2014-12-06 19:34 ` redi at gcc dot gnu.org
2015-01-16 18:55 ` rearnsha at gcc dot gnu.org
2020-11-23 13:13 ` redi at gcc dot gnu.org

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-63829-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: link
Be 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).