clang_delta segfault
Hi, I'm using cvise from Ubuntu 24.10 repos. Tried to reduce a GCC ICE, all ClangDelta passes reported segfaults, all Clang passes reported "non-fatal errors", so here is a reduced test which crashes clang_delta:
template<class>
struct a {
struct {
struct b c;
} static g;
void* d = g;
constexpr a() {
}
using e = a<b>;
e f() {
e();
}
};
note that the code does not crash Clang 19.1
Found this info in cvise_bug folder
Package: cvise 2.10.0
Git version: unknown
LLVM version: 19.1.0
System: uname_result(system='Linux', node='8bd18241cab4', release='5.15.0-117-generic', version='#127~20.04.1-Ubuntu SMP Thu Jul 11 15:36:12 UTC 2024', machine='x86_64')
***************************************************
ClangPass::remove-nested-function has encountered a bug:
pass error
state: 1
and my interestingness test
#!/bin/bash
timeout 10 /usr/lib/cvise/clang_delta --query-instances=simple-inliner --std=c++2b test.cpp
exit $(($?-139))
Another reduction, this time can be compiled https://godbolt.org/z/WKqG3xY69 Doubt that it was needed but just in case
class a;
namespace std {
template<typename...>
struct coroutine_traits;
template<typename = void>
struct coroutine_handle {
static coroutine_handle from_address(void*);
operator coroutine_handle<>();
};
} // namespace std
struct b {
bool await_ready() noexcept;
void await_suspend(std::coroutine_handle<>) noexcept;
void await_resume() noexcept;
};
template<typename, typename>
class c;
template<typename dg, typename d>
class awaitable {
public:
bool await_ready();
template<class e>
void await_suspend(std::coroutine_handle<c<e, d>>);
dg await_resume();
};
template<typename>
class f {
public:
auto initial_suspend() {
return b();
}
auto final_suspend() noexcept {
return b{};
}
void unhandled_exception();
};
template<typename dg, typename d>
class c : public f<d> {
public:
awaitable<dg, d> get_return_object();
};
namespace std {
template<typename dg, typename d, typename... g>
struct coroutine_traits<awaitable<dg, d>, g...> {
using promise_type = c<dg, d>;
};
} // namespace std
awaitable<int, a> h() {
co_await h();
}
#!/bin/bash
clang++-19 -c common_cvise.cpp -o /dev/null -std=c++23 || exit 1
/usr/lib/cvise/clang_delta --query-instances=simple-inliner --std=c++2b common_cvise.cpp
exit $(($?-139))
Hey, thanks for the report. Unfortunatelly, the project is seeking for a maintainer and I won't be able to make any further development of the project. Thanks for understanding. You might be lucky and get a feedback from the original C-Reduce project which shared the clang_delta core.