Skip to content
Snippets Groups Projects

[Makefile] Add asan(-test) targets

Merged Florian Schmaus requested to merge flow/emper:asan into master
2 files
+ 28
2
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -175,7 +175,16 @@ class AbstractSemaphoreWorkerSleepStrategy
@@ -175,7 +175,16 @@ class AbstractSemaphoreWorkerSleepStrategy
AbstractSemaphoreWorkerSleepStrategy(Runtime& runtime, workerid_t workerCount)
AbstractSemaphoreWorkerSleepStrategy(Runtime& runtime, workerid_t workerCount)
: workerCount(workerCount), stats(runtime) {
: workerCount(workerCount), stats(runtime) {
if constexpr (useGenericNotifySpecificImpl) {
if constexpr (useGenericNotifySpecificImpl) {
states = new (std::align_val_t(CACHE_LINE_SIZE)) std::atomic<SleeperState>[workerCount];
// If ASAN is used, then it will rightfully complain about a
 
// mismatched aligned-new with and unaligned-delete
 
// below. However if we use the aligned-delete, then we get, at
 
// least on my machine, an "unused argumetn" error (see comment
 
// below).
 
states = new
 
#ifndef __SANITIZE_ADDRESS__
 
(std::align_val_t(CACHE_LINE_SIZE))
 
#endif
 
std::atomic<SleeperState>[workerCount];
}
}
if constexpr (semNeedsInit) {
if constexpr (semNeedsInit) {
@@ -183,7 +192,12 @@ class AbstractSemaphoreWorkerSleepStrategy
@@ -183,7 +192,12 @@ class AbstractSemaphoreWorkerSleepStrategy
}
}
}
}
~AbstractSemaphoreWorkerSleepStrategy() { delete[] states; }
~AbstractSemaphoreWorkerSleepStrategy() {
 
// This should actually use an aligned delete, i.e.,
 
// delete[](std::align_val_t(CACHE_LINE_SIZE), states);
 
// however, this throws "unused first argument" errors when compiling.
 
delete[] states;
 
}
[[nodiscard]] inline auto getSleeping() const -> long { return wakeupSem.getValue(); }
[[nodiscard]] inline auto getSleeping() const -> long { return wakeupSem.getValue(); }
Loading