https://bugs.llvm.org/show_bug.cgi?id=50863
Bug ID: 50863
Summary: miscompile with templated coroutine
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
The following program miscompiles, https://godbolt.org/z/9nPze58xj
// Coroutine miscompile reproducer.
//
// clang version 12.0.0
// Target: x86_64-unknown-linux-gnu
//
// Compile with `clang++ -std=c++20 -stdlib=libc++ -fsanitize=undefined -O0`.
#include <experimental/coroutine>
struct task{
struct promise_type {
task get_return_object() { return {}; }
std::experimental::suspend_never initial_suspend() { return {}; }
std::experimental::suspend_never final_suspend() noexcept { return {}; }
void return_void() {}
void unhandled_exception() {}
};
};
namespace std::experimental {
template <typename ...Args>
struct coroutine_traits<task, Args...> {
using promise_type = typename task::promise_type;
};
}
template <typename T>
task foo(T) noexcept {
co_return;
}
int main() {
foo(0);
}
Compiler output:
ASM generation compiler returned: 0
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
3 errors generated.
Execution build compiler returned: 1
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs