Skip to content

Commit bf3cb27

Browse files
committed
[Hipcc] Mark ~HipBinBase as virutal
For hipBinNVPtr_ and hipBinAMDPtr_ members: the destructor of the base class was not marked as virtual, but the destructor of the derived classes are. When we delete the object we do it through a pointer to the base class. So the base class destructor is called but not the one of the derived classes. This results in strange memory behaviour detected by ASAN. Solves SWDEV-516418
1 parent 528a697 commit bf3cb27

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

amd/hipcc/src/hipBin_amd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class HipBinAmd : public HipBinBase {
5151

5252
public:
5353
HipBinAmd();
54-
virtual ~HipBinAmd() = default;
54+
~HipBinAmd() override = default;
5555
virtual bool detectPlatform();
5656
virtual void constructCompilerPath();
5757
virtual const string& getCompilerPath() const;

amd/hipcc/src/hipBin_base.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ enum HipBinCommand {
203203
class HipBinBase {
204204
public:
205205
HipBinBase();
206+
virtual ~HipBinBase() = default;
206207
// Interface functions
207208
virtual void constructCompilerPath() = 0;
208209
virtual void printFull() = 0;

amd/hipcc/src/hipBin_nvidia.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class HipBinNvidia : public HipBinBase {
3737

3838
public:
3939
HipBinNvidia();
40-
virtual ~HipBinNvidia() = default;
40+
~HipBinNvidia() override = default;
4141
virtual bool detectPlatform();
4242
virtual void constructCompilerPath();
4343
virtual const string& getCompilerPath() const;

0 commit comments

Comments
 (0)