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
My __enzyme_virtualreverse class used in differentiating for a virtual function contains several parameters arrays, therefore I would like to manage it manually. But when I call delete on a virtual reverse class with a virtual destructor, enzyme gives following warning:
freeing without malloc %class.BaseClass* %0
freeing without malloc %class.BaseClass* %0
And also it segfaults at runtime.
How to properly clean memory in such cases?
Below is the example code (I do not know how to enable warnings in compiler explorer therefore giving source as well)
Example code: https://fwd.gymni.ch/CkxEnB
freeing without malloc %class.BaseClass* %0
freeing without malloc %class.BaseClass* %0
and segfaults.
Without virtual destructor:
example.cpp:28:5: warning: delete called on non-final 'BaseClass' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]
delete d_bc;
This discussion was converted from issue #929 on April 02, 2023 16:38.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
My
__enzyme_virtualreverseclass used in differentiating for a virtual function contains several parameters arrays, therefore I would like to manage it manually. But when I call delete on a virtual reverse class with a virtual destructor, enzyme gives following warning:And also it segfaults at runtime.
How to properly clean memory in such cases?
Below is the example code (I do not know how to enable warnings in compiler explorer therefore giving source as well)
Example code: https://fwd.gymni.ch/CkxEnB
compiled as:
Outputs:
and segfaults.
But incomplete destruction.
Beta Was this translation helpful? Give feedback.
All reactions