https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95137
--- Comment #5 from Rafael Avila de Espindola <rafael at espindo dot la> ---
With a seastar patched for c++ 20 (mostly dropping a few experimental/ from
includes and experimental:: from names), the following is all that is needed:
#include <seastar/core/app-template.hh>
#include <seastar/core/coroutine.hh>
using namespace seastar;
int main(int argc, char** argv) {
seastar::app_template app;
app.run(argc, argv, [] () -> future<> {
future<> xyz = make_ready_future<>().then([] {});
co_await std::move(xyz);
});
return 0;
}
I have attached a partially preprocessed version that can be use with current
seastar from https://github.com/scylladb/seastar.
First build seastar in debug mode:
$ mkdir build
$ cd build
$ cmake -DCMAKE_BUILD_TYPE=Debug .. -GNinja
$ ninja
And the test can be built with
$ g++ test.cc -fcoroutines $(pkg-config --cflags --libs
<dir>/seastar/build-dbg/seastar.pc --static) -o t-asan
It crashes like this:
$ export ASAN_OPTIONS=disable_coredump=0:abort_on_error=1
$ export UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1
$ gdb --args ./t-asan -c 1
...
run
...
test.cc:3749:5: runtime error: member call on misaligned address 0x000041b58ab3
for type 'struct awaiter', which requires 8 byte alignment
0x000041b58ab3: note: pointer points here
<memory cannot be printed>
If seastar is build with clang (CC=clang CXX=clang++ cmake...) or if the
sanitizers are disabled (-DSeastar_SANITIZE=OFF) and valgrind is used instead,
the program doesn't crash.