mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
malloc: add indirection for malloc(-like) functions in tests [BZ #32366]
GCC 15 introduces allocation dead code removal (DCE) for PR117370 in r15-5255-g7828dc070510f8. This breaks various glibc tests which want to assert various properties of the allocator without doing anything obviously useful with the allocated memory. Alexander Monakov rightly pointed out that we can and should do better than passing -fno-malloc-dce to paper over the problem. Not least because GCC 14 already does such DCE where there's no testing of malloc's return value against NULL, and LLVM has such optimisations too. Handle this by providing malloc (and friends) wrappers with a volatile function pointer to obscure that we're calling malloc (et. al) from the compiler. Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
#include <libc-diag.h>
|
||||
#include <support/check.h>
|
||||
|
||||
#include "tst-malloc-aux.h"
|
||||
|
||||
static int
|
||||
do_test (void)
|
||||
{
|
||||
|
Reference in New Issue
Block a user