<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Stepping for C++ coroutines is broken"
href="https://bugs.llvm.org/show_bug.cgi?id=39651">39651</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Stepping for C++ coroutines is broken
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>davide@freebsd.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, modocache@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>#include <experimental/coroutine>
using namespace std::experimental;
coroutine_handle<> g;
struct coro {
struct promise_type {
coro get_return_object() {
g = coroutine_handle<promise_type>::from_promise(*this);
return {};
}
suspend_never initial_suspend() { return {}; }
suspend_never final_suspend() { return {}; }
void return_void() {}
void unhandled_exception() {}
};
};
coro f() {
int i = 0;
++i; // break here
co_await suspend_always();
++i; // break here
co_await suspend_always();
int j = 0; // break here
++i; // break here
++j;
co_await suspend_always();
++j; // break here
}
int main() {
f();
g.resume();
g.resume();
g.resume();
}
# Run inside lldb:
Process 59665 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
frame #0: 0x000000010000100d a.out`main at coro.cpp:35:5
32
33 int main() {
34 f();
-> 35 g.resume();
36 g.resume();
37 g.resume();
38 }
(lldb) s
Process 59665 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step in
frame #0: 0x0000000100001019 a.out`main at coro.cpp:36:5
33 int main() {
34 f();
35 g.resume();
-> 36 g.resume();
37 g.resume();
38 }
So `step` skips entirely the resumption thunk inside the coroutine.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>