[dlmalloc] Fix -Wnull-pointer-arithmetic
Arithmetic on a NULL pointer is undefined behaviour and could be used by the compiler to optimize out the arithmetic. Use the integer expansion of chunk2mem(0) instead to silence this warning: `arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Wnull-pointer-arithmetic]`
This commit is contained in:
committed by
Travis Geiselbrecht
parent
a1eb850079
commit
7b12b201fd
2
external/lib/heap/dlmalloc/dlmalloc.c
vendored
2
external/lib/heap/dlmalloc/dlmalloc.c
vendored
@@ -2784,7 +2784,7 @@ static int has_segment_link(mstate m, msegmentptr ss) {
|
||||
noncontiguous segments are added.
|
||||
*/
|
||||
#define TOP_FOOT_SIZE\
|
||||
(align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE)
|
||||
(align_offset(/*chunk2mem(0)*/TWO_SIZE_T_SIZES)+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE)
|
||||
|
||||
|
||||
/* ------------------------------- Hooks -------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user