public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/63829] New: Crash in__tls_init when -mcpu=arm1176jzf-s is used
@ 2014-11-12  1:27 aaron at aarongraham dot com
  2014-11-12  1:27 ` [Bug c++/63829] " aaron at aarongraham dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: aaron at aarongraham dot com @ 2014-11-12  1:27 UTC (permalink / raw)
  To: gcc-bugs

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)


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

end of thread, other threads:[~2020-11-23 13:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-12  1:27 [Bug c++/63829] New: Crash in__tls_init when -mcpu=arm1176jzf-s is used aaron at aarongraham dot com
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

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).