Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault when linked with libunwind #1665

Closed
hbrunie opened this issue Jul 10, 2019 · 3 comments
Closed

Segmentation fault when linked with libunwind #1665

hbrunie opened this issue Jul 10, 2019 · 3 comments
Labels
kind: bug state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated

Comments

@hbrunie
Copy link

hbrunie commented Jul 10, 2019

I tried to run an example code, and when linking with libunwind it segfaults.

You can reproduce by downloading libunwind (master branch, b316234d63c7ff6fcfac6d72e0f27394fe86af80), install ./configure --prefix .... ; make ; make install

The simple example used is: json/doc/examples/README.cpp
compile with g++ -o test README.cpp -std=c++11 -I. -L /path/to/libunwind -lunwind

g++ --version
g++ (GCC) 7.3.0 20180125 (Cray Inc.)

uname -a
Linux cori01 4.4.178-94.91-default #1 SMP Thu May 2 20:14:31 UTC 2019 (d683ca1) x86_64 x86_64 x86_64 GNU/Linux

Reproduced with both develop and master branches.

@hbrunie
Copy link
Author

hbrunie commented Jul 11, 2019

gdb ./a.out
backtrace
#0 0x0000000000000000 in ?? ()
#1 0x00002aaaaaf92a11 in __gthread_once (__func=0x2aaaaaf929b0 std::locale::_S_initialize_once(), __once=)
at /b/tmp/peint/build-cray-gcc-20180126.202237.011353000/cray-gcc/BUILD/snos_objdir/x86_64-suse-linux/libstdc++-v3/include/x86_64-suse-linux/bits/gthr-default.h:699
#2 std::locale::_S_initialize () at ../../../../../cray-gcc-7.3.0-201801270210.d61239fc6000b/libstdc++-v3/src/c++98/locale_init.cc:316
#3 0x00002aaaaaf92a73 in std::locale::locale (this=0x2aaaab26e7f8 <__gnu_internal::buf_cout_sync+56>) at ../../../../../cray-gcc-7.3.0-201801270210.d61239fc6000b/libstdc++-v3/src/c++98/locale_init.cc:250
#4 0x00002aaaaaf8f751 in std::basic_streambuf<char, std::char_traits >::basic_streambuf (this=)
at /b/tmp/peint/build-cray-gcc-20180126.202237.011353000/cray-gcc/BUILD/snos_objdir/x86_64-suse-linux/libstdc++-v3/include/streambuf:466
#5 __gnu_cxx::stdio_sync_filebuf<char, std::char_traits >::stdio_sync_filebuf (__f=0x2aaaabb262a0 <IO_2_1_stdout>, this=)
at /b/tmp/peint/build-cray-gcc-20180126.202237.011353000/cray-gcc/BUILD/snos_objdir/x86_64-suse-linux/libstdc++-v3/include/ext/stdio_sync_filebuf.h:80
#6 std::ios_base::Init::Init (this=) at ../../../../../cray-gcc-7.3.0-201801270210.d61239fc6000b/libstdc++-v3/src/c++98/ios_init.cc:85
#7 0x00000000004036d0 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at /opt/gcc/7.3.0/snos/include/g++/iostream:74
#8 0x00000000004036fa in _GLOBAL__sub_I_main () at test.cpp:39
#9 0x000000000041462d in __libc_csu_init (argc=1, argv=0x7fffffff7118, envp=0x7fffffff7128) at elf-init.c:88
#10 0x00002aaaab7a66b5 in __libc_start_main () from /lib64/libc.so.6
#11 0x00000000004028b9 in _start () at ../sysdeps/x86_64/start.S:118

This makes me think of an incompatibility between libunwind compiled with GCC and
json lib compiled using some c++11 features.

@hbrunie
Copy link
Author

hbrunie commented Jul 11, 2019

The bug is reproducible with:
#include
#include <nlohmann/json.hpp>

using json = nlohmann::json;
int main()
{
json j;
std::cout << j;
}

compiled with:
g++ -std=c++11 test.cpp -I. -L /global/homes/h/hbrunie/usr/lib/ -lunwind -O0

@stale
Copy link

stale bot commented Aug 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Aug 10, 2019
@stale stale bot closed this as completed Aug 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated
Projects
None yet
Development

No branches or pull requests

1 participant