From c08ceacdbc096a05f520c99e5b7f230212c249bb Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 29 Aug 2018 18:38:55 +0200 Subject: Circumvent optimisation bug in clang, and fix bug in have_custom_malloc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libsimple.c | 3 +++ test.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/libsimple.c b/libsimple.c index d6eb2ce..641748a 100644 --- a/libsimple.c +++ b/libsimple.c @@ -87,6 +87,9 @@ test_vasprintfa(const char *expected, const char *format, ...) } #endif +#ifdef __clang__ +__attribute__((optnone)) +#endif int main(void) { diff --git a/test.c b/test.c index 4669716..084359e 100644 --- a/test.c +++ b/test.c @@ -43,7 +43,9 @@ round_up(size_t size) int have_custom_malloc(void) { + size_t old_alloc_fail_in = alloc_fail_in; free(malloc(1)); + alloc_fail_in = old_alloc_fail_in; return custom_malloc; } -- cgit v1.2.3-70-g09d2