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
ConstantDataSequential is a non-polymorphic base class of ConstantDataArray and ConstantDataVector. *Entry is unique_ptr<ConstantDataSequential> and it gets to own either a dynamically allocated ConstantDataArray or ConstantDataVector, but at the end of its lifetime it deletes the owned object through a pointer of ConstantDataSequential. As ConstantDataSequential has no virtual destructor, this is undefined behavior.
The undefined behavior might manifest benignly or less benignly depending whether sized deallocation functions are enabled.
leni536
changed the title
Possibly undefined delete due to unsafe conversion of unique_ptr
Possibly undefined delete due to unsafe use of unique_ptr
Jun 27, 2024
llvm-project/llvm/lib/IR/Constants.cpp
Lines 2819 to 2835 in 868b90d
ConstantDataSequential
is a non-polymorphic base class ofConstantDataArray
andConstantDataVector
.*Entry
isunique_ptr<ConstantDataSequential>
and it gets to own either a dynamically allocatedConstantDataArray
orConstantDataVector
, but at the end of its lifetime it deletes the owned object through a pointer ofConstantDataSequential
. AsConstantDataSequential
has no virtual destructor, this is undefined behavior.The undefined behavior might manifest benignly or less benignly depending whether sized deallocation functions are enabled.
The bug was found by a reference implementation of https://wg21.link/P2413R1 .
The text was updated successfully, but these errors were encountered: