Files
valgrind/dhat
Paul Floyd a265a20620 Add memcheck errors for aligned and sized allocations and deallocations
Bug 433857 Add validation to C++17 aligned new/delete alignment size
Bug 433859 Add mismatched detection to C++ 17 aligned new/delete
Bug 466105 aligned_alloc problems, part 2
Bug 467441 Add mismatched detection to C++ 14 sized delete

Memcheck now tests and warns about the values used for
alignment and size. These apply to various functions: memalign,
posix_memalign and aligned_alloc in C and various overloads
of operators new and delete in C++. The kinds of error that can
be detected are
- invalid alignment, for instance the alignment is usually required
  to be a power of 2
- mismatched alignment between aligned allocation and aligned
  deallocation
- mismatched size when sized delete is used
- bad size for functions that have implementation defined behaviour
  when the requested size is zero

An example of the new errors is:

int *pi = memalign(31, 100);

which will generate the following error

==96206== Invalid alignment value: 31 (should be power of 2)
==96206==    at 0x485195E: memalign (vg_replace_malloc.c:1886)
==96206==    by 0x20200E: main (memalign.c:59)
2023-09-02 16:12:35 +02:00
..
2019-02-01 14:54:34 +11:00