-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Apply ASAN compile/link options on dependencies
- Loading branch information
1 parent
78206b9
commit 76fc76d
Showing
4 changed files
with
95 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(asan) | ||
project(test_asan) | ||
|
||
include(../../rocbuild.cmake) | ||
|
||
add_executable(test basic-global-overflow.cpp) | ||
add_executable(basic-global-overflow basic-global-overflow.cpp) | ||
rocbuild_target_enable_asan(basic-global-overflow) | ||
|
||
rocbuild_enable_asan(test) | ||
add_library(matrix INTERFACE matrix.hpp) | ||
add_executable(test_matrix test_matrix.cpp) | ||
target_link_libraries(test_matrix PRIVATE matrix) | ||
rocbuild_target_enable_asan(matrix) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#pragma once | ||
|
||
class Matrix | ||
{ | ||
public: | ||
Matrix(int rows, int cols) : rows(rows), cols(cols) | ||
{ | ||
data = new int[rows * cols]; | ||
} | ||
|
||
~Matrix() | ||
{ | ||
delete[] data; | ||
} | ||
|
||
int& operator()(int i, int j) | ||
{ | ||
return data[i * cols + j]; | ||
} | ||
|
||
int operator()(int i, int j) const | ||
{ | ||
return data[i * cols + j]; | ||
} | ||
|
||
int getRows() const | ||
{ | ||
return rows; | ||
} | ||
|
||
int getCols() const | ||
{ | ||
return cols; | ||
} | ||
|
||
private: | ||
int rows; | ||
int cols; | ||
int* data; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "matrix.hpp" | ||
#include <stdio.h> | ||
|
||
int main() | ||
{ | ||
Matrix m(2, 2); | ||
m(0, 0) = 1; | ||
|
||
Matrix m2 = m; | ||
|
||
printf("bye\n"); | ||
|
||
return 0; | ||
} |