summaryrefslogtreecommitdiff
path: root/test/always_memset.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/always_memset.c')
-rw-r--r--test/always_memset.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/test/always_memset.c b/test/always_memset.c
index eed15cab27..8a022ef8ef 100644
--- a/test/always_memset.c
+++ b/test/always_memset.c
@@ -78,8 +78,13 @@ fake_builtin_memset(char *dest, char c, size_t len)
* functionality.
* - To check how much of the stack |space| was used by the caller,
* run "x/256xb $adr" or "x/64xw $adr" after the memcpy.
+ *
+ * Disable ASAN with the attribute because this function returns a pointer to
+ * stack memory, which is normally very naughty, but is what we want to test
+ * here.
*/
-test_static void exercise_memset(char **p)
+__attribute__((no_sanitize("address"))) test_static void
+exercise_memset(char **p)
{
/*
* Add extra stack space so that |buf| doesn't get trampled while the
@@ -134,8 +139,13 @@ test_static int test_optimization_working(void)
* to optimize out the last memset due to no side effect.
*
* This function layout must remain identical to exercise_memset.
+ *
+ * Disable ASAN with the attribute because this function returns a pointer to
+ * stack memory, which is normally very naughty, but is what we want to test
+ * here.
*/
-test_static void exercise_always_memset(char **p)
+__attribute__((no_sanitize("address"))) test_static void
+exercise_always_memset(char **p)
{
/*
* Add extra stack space so that |buf| doesn't get trampled while the