From 16ffd18660fdf09ce2f671a2e3e8245242c94607 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Mon, 27 Dec 2021 21:27:41 +0300 Subject: Declare cleared_p as volatile in realloc for any GCC version (fix of commit eca62c130) Issue #406 (bdwgc). * mallocx.c [_FORTIFY_SOURCE && !__clang__] (GC_realloc): Declare cleared_p variable as volatile for any GCC version. --- mallocx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mallocx.c') diff --git a/mallocx.c b/mallocx.c index 0692565e..7f7f0966 100644 --- a/mallocx.c +++ b/mallocx.c @@ -79,7 +79,7 @@ GC_API void * GC_CALL GC_realloc(void * p, size_t lb) struct hblk * h; hdr * hhdr; void * result; -# if defined(_FORTIFY_SOURCE) && GC_GNUC_PREREQ(9, 0) && !defined(__clang__) +# if defined(_FORTIFY_SOURCE) && defined(__GNUC__) && !defined(__clang__) volatile /* Use cleared_p instead of p as a workaround to avoid */ /* passing alloc_size(lb) attribute associated with p */ /* to memset (including memset call inside GC_free). */ -- cgit v1.2.1