Typically it’s ineffective to use ‘void *volatile p’
when testing malloc and similar functions, as the compiler
can optimize the call to malloc before assigning the result
to the volatile pointer variable. Instead, be more systematic
about calling malloc through a volatile function pointer
so that the compiler cannot infer that it is a malloc call.
This fix can’t be done for alloca-like functions which may not
have a function address, so continue to trust to luck there.
* tests/test-aligned-malloc.c (aligned4_malloc, aligned4_free)
(aligned8_malloc, aligned8_free, aligned16_malloc)
(aligned16_free, aligned32_malloc, aligned32_free):
* tests/test-aligned_alloc.c (aligned_alloc):
* tests/test-calloc-gnu.c (calloc):
* tests/test-free.c (free):
* tests/test-malloc-gnu.c (malloc):
* tests/test-reallocarray.c (reallocarray):
Test indirectly, by calling through a volatile pointer.
* tests/test-aligned-malloc.c, tests/test-aligned_alloc.c:
* tests/test-calloc-gnu.c, tests/test-calloc-posix.c:
* tests/test-free.c, tests/test-malloc-gnu.c:
* tests/test-malloc-posix.c, tests/test-realloc-posix.c:
* tests/test-reallocarray.c:
(main) Don’t bother making data pointers olatile, as it’s ineffective.
* tests/test-calloc-gnu.c (identity):
* tests/test-free.c (get_errno, get_errno_func):
Remove; all uses removed.