From 6c46c8a3a0412e417ef943728991f204e1c6d39d Mon Sep 17 00:00:00 2001 From: Giuliano Belinassi Date: Thu, 11 Apr 2024 12:41:40 -0300 Subject: [PATCH] debug heisenbug --- tests/process_access.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/process_access.c b/tests/process_access.c index 1900be45..5ab510cd 100644 --- a/tests/process_access.c +++ b/tests/process_access.c @@ -26,9 +26,19 @@ static char *banner = "Original banner"; /* Noinline must be set, else no calls are issued. */ -char *__attribute__((noinline)) banner_get(void) { return banner; } +char *__attribute__((noinline)) banner_get(void) { printf("banner addr: 0x%lx\n", (unsigned long)banner); return banner; } + +/* Since clang-18 when compiling this function it is broken in two parts: + banner_set and banner_set.specialized.1. We don't want it on this test so + we disable optimizations in this test. */ +#ifdef __clang__ +#pragma clang optimize off +#endif void __attribute__((noinline)) banner_set(char *new) { banner = new; } +#ifdef __clang__ +#pragma clang optimize on +#endif int main(void)