Issue |
156130
|
Summary |
UBSan SEGV during destructor
|
Labels |
new issue
|
Assignees |
|
Reporter |
ndunsworth
|
I'm trying to figure out if this is a me problem or a false positive.
During the destructor of my derived class UBSan is throwing a SEGV when the SubClass worker thread performs its cleanup and accesses the parent class impl data.
I would expect that since the DerivedClass destructor is blocked waiting for the thread to finish that the unique_ptr is still valid since the BaseClass destructor hasn't been called to free the unique_ptr.
In my debugger, lldb, when I look in the destructor of DerivedClass it shows a valid memory address for impl. However when looking at variables in _**cleanup_called_by_thread**_ impl shows up as not a valid memory address.
```c++
class BaseClass {
std::unique_ptr<ImplData> impl;
};
class DerivedClass : BaseClass {
~DerivedClass() {
// blocks while the thread cleans up
// thread has exited when this returns and no longer
// accesses this object
this->thread->stop();
}
// Called by thread during cleanup
void cleanup_called_by_thread() {
// this->impl shows as an invalid memory location
ImplData* data = "" // SEGV
}
}
```
When I print out the address of _**this**_ in the cleanup func I get a totally different address then I do when i print out the address of _**this**_ in the destructor.
```c++
~DerivedClass() {
// this = 0x6356caca5470
}
DerivedClass::cleanup_called_by_thread() {
// this = 0xa6deb54
}
```
Anyways I'm a noob at this but loving the different *sans, have already cleaned up a number of things since integrating them this week.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs