lewissbaker / cppcoro

A library of C++ coroutine abstractions for the coroutines TS
MIT License
3.43k stars 472 forks source link

SIBABRT while running the optimized tests under ubuntu 16.04 #61

Closed blapid closed 7 years ago

blapid commented 7 years ago

Hi, I was very interested in trying this out, so I've followed the steps in the readme and got the tests to compile with a libc++ that I've compiled from llvm. Then I tried running: build/linux_x64_clang5.0_optimised/test/run which caught a segfault and printed:

*** Error in `build/linux_x64_clang5.0_optimised/test/run': munmap_chunk(): invalid pointer: 0x00007ffe92d2ff78 ***

Seeing as this is probably some libc assert I ran it under gdb to get a better stack trace:

#0  0x00007ffff775b428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ffff775d02a in __GI_abort () at abort.c:89
#2  0x00007ffff779d7ea in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7ffff78b6e98 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175
#3  0x00007ffff77aa698 in malloc_printerr (ar_ptr=0x0, ptr=<optimized out>, str=0x7ffff78b6ec0 "munmap_chunk(): invalid pointer", action=<optimized out>) at malloc.c:5006
#4  munmap_chunk (p=<optimized out>) at malloc.c:2842
#5  __GI___libc_free (mem=<optimized out>) at malloc.c:2963
#6  0x000000000027eb1a in std::experimental::coroutines_v1::coroutine_handle<void>::resume (this=0x8) at /usr/opt/llvm/include/c++/v1/experimental/coroutine:123
#7  cppcoro::single_consumer_event::set (this=0x0) at ./include/cppcoro/single_consumer_event.hpp:55
#8  _DOCTEST_ANON_FUNC_18()::$_15::operator()() const (this=<optimized out>) at test/shared_task_tests.cpp:215
#9  0x000000000027e01f in cppcoro::when_all_ready<cppcoro::task<void>, cppcoro::task<void> > (tasks=..., tasks=...) at /usr/opt/llvm/include/c++/v1/experimental/coroutine:123
#10 0x00000000002a4c0f in cppcoro::sync_wait<cppcoro::task<std::__1::tuple<cppcoro::task<void>, cppcoro::task<void> > > > (task=<optimized out>)
    at /usr/opt/llvm/include/c++/v1/experimental/coroutine:123
#11 0x000000000027d825 in _DOCTEST_ANON_FUNC_18 () at test/shared_task_tests.cpp:203
#12 0x000000000023d76a in doctest::Context::run (this=0x7fffffffdde8) at test/doctest/doctest.h:5641
#13 0x000000000023ea1e in main (argc=1, argv=0x7fffffffdee8) at test/doctest/doctest.h:5749

Which might suggest that __builtin_coro_resume is misbehaving, but I'm not sure as I'm still new to these additions.

clang-5.0 --version:

clang version 5.0.1-svn314893-1~exp1 (branches/release_50)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Hope this is helpful, if I've missed anything let me know.

blapid commented 7 years ago

Hm, apparently it's already known: https://github.com/lewissbaker/cppcoro/issues/57 My bad. Closing.