From 9fa9572196b757abc91da3aa0ac318614f390827 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 4 May 2021 14:14:54 +0200 Subject: [PATCH] Hide Asan error. Certainly a false positive seen with s4u-exec-ptask and swapped contexts: ==3408837==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7fbcf3ffe0f0 at pc 0x7fbcf83efc32 bp 0x7fbcf3ffe040 sp 0x7fbcf3ffe038 WRITE of size 8 at 0x7fbcf3ffe0f0 thread T0 #0 0x7fbcf83efc31 in _M_init_functor ../src/s4u/s4u_Activity.cpp:63 #1 0x7fbcf83efc31 in _M_init_functor /usr/include/c++/10/bits/std_function.h:208 #2 0x7fbcf83efc31 in function >:: > /usr/include/c++/10/bits/std_function.h:609 #3 0x7fbcf83efc31 in simcall > ../include/simgrid/simix.hpp:60 #4 0x7fbcf83efc31 in simgrid::s4u::Activity::cancel() ../src/s4u/s4u_Activity.cpp:63 #5 0x55e051d23c53 in simgrid::s4u::Activity_T::cancel() ../include/simgrid/s4u/Activity.hpp:223 #6 0x55e051d23c53 in runner ../examples/cpp/exec-ptask/s4u-exec-ptask.cpp:61 #7 0x7fbcf84d9d51 in std::function::operator()() const /usr/include/c++/10/bits/std_function.h:622 #8 0x7fbcf84d9d51 in simgrid::kernel::context::Context::operator()() const ../src/kernel/context/Context.hpp:65 #9 0x7fbcf84d9d51 in smx_ctx_wrapper ../src/kernel/context/ContextSwapped.cpp:51 --- src/s4u/s4u_Activity.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/s4u/s4u_Activity.cpp b/src/s4u/s4u_Activity.cpp index a8b2c76a96..a174119b82 100644 --- a/src/s4u/s4u_Activity.cpp +++ b/src/s4u/s4u_Activity.cpp @@ -60,7 +60,10 @@ bool Activity::test() Activity* Activity::cancel() { - kernel::actor::simcall([this] { pimpl_->cancel(); }); + kernel::actor::simcall([this] { + XBT_HERE(); + pimpl_->cancel(); + }); complete(State::CANCELED); return this; } -- 2.20.1