Skip to content

Commit b9da5c2

Browse files
authored
[Hipcc] Mark ~HipBinBase as virutal (llvm#1262)
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 Co-authored-by: Juan Manuel Martinez Caamaño <[email protected]>
1 parent 86c7782 commit b9da5c2

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
@@ -52,7 +52,7 @@ class HipBinAmd : public HipBinBase {
5252

5353
public:
5454
HipBinAmd();
55-
virtual ~HipBinAmd() = default;
55+
~HipBinAmd() override = default;
5656
virtual bool detectPlatform();
5757
virtual void constructCompilerPath();
5858
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
@@ -38,7 +38,7 @@ class HipBinNvidia : public HipBinBase {
3838

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

0 commit comments

Comments
 (0)