You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running it using nidhuggc -std=c++17 -pthread -- --sc test.cpp. The stack allocation version works fine, while the use of new causes segfault, with the warning, WARNING: Calling unknown external function _Znwm as blackbox.
#include<pthread.h>
#include<new>usingnamespacestd;namespace {
structNode {
pthread_mutex_t _m;
Node() {
pthread_mutex_init(&_m, nullptr);
}
};
voidmy_lock(Node* n) {
pthread_mutex_lock(&n->_m);
}
voidmy_unlock(Node* n) {
pthread_mutex_unlock(&n->_m);
}
Node* head;
voidt0()
{
my_lock(head);
my_unlock(head);
}
} // namespaceintmain()
{
// head = new Node(); // segmentation fault
Node n;
head = &n;
constexprauto n_thread = 2;
pthread_t threads[n_thread];
for (auto i = 0; i < n_thread; ++i) {
pthread_create(
&threads[i],
nullptr,
[](void*) -> void* {t0(); returnnullptr;},
nullptr);
}
for (auto i = 0; i < n_thread; ++i) {
pthread_join(threads[i], nullptr);
}
return0;
}
The text was updated successfully, but these errors were encountered:
Right now, nidhuggc only supports the parts of the c and c++ standard libraries that inline (plus a short list of extra functions from the c standard library). In order to use more library functions, these have to be compiled to LLVM IR and linked to the program to be tested. Klee solves this by bundling its own C and C++ libraries which it builds LLVM IR for. I'd like Nidhugg to do something similar, but it doesn't yet. I'll open an issue to track it.
I thought that operator new would inline, but this might depend on which STL implementation is used.
Running it using
nidhuggc -std=c++17 -pthread -- --sc test.cpp
. The stack allocation version works fine, while the use ofnew
causes segfault, with the warning,WARNING: Calling unknown external function _Znwm as blackbox
.The text was updated successfully, but these errors were encountered: