Compile with SaiphC Compiler, Run, and See Memory Errors
$ sfc prog.c
$ ./a.out
Memory access error: writing to the outside of a memory block; abort!
# Writing 1 bytes to 0xffd77320 will clobber other memory-blocks.
#
# The memory-block-to-be-written (start:0xffd772bc, size:10 bytes) is bound to 'p' at
# file:/prog.c::6, 8
#
# 0xffd772bc 0xffd772c5
# +------------------------------+
# |the memory-block-to-be-written|......
# +------------------------------+
# ^~~~~~~~~~
# the write starts at 0xffd77320 that is 90 bytes after the memory-block end.
#
# Stack trace (most recent call first) of the write.
# [0] file:/prog.c::7, 3
# [1] [libc-start-main]
$ sfc prog.c
$./a.out
Memory access error: freeing a freed memory block; abort!
# The memory-block-to-be-freed (start:0x9494010, size:10 bytes) was allocated at
# file:/prog.c::14, 14
# [libc-start-main]
# It has been freed at
# file:/prog.c::10, 5
# file:/prog.c::15, 3
# [libc-start-main]
#
# Stack trace (most recent call first) of the error.
# [0] file:/musl-1.1.10/src/malloc/new_dts_memory_util.c::40, 5
# [1] file:/musl-1.1.10/src/malloc/safe_malloc.c::114, 3
# [2] file:/prog.c::16, 3
# [3] [libc-start-main]
$ sfc prog.c
$ DTS_REPORT_UNRELEASED_MEMORY=1 DTS_REPORT_ALL_MEMORY_SPACES=1 ./a.out
Unfreed memory warning: memory blocks are not freed before exit.
# a memory block (start:0x82ca010, size:10 bytes) is allocated at
# file:/prog.c::8, 10
# file:/prog.c::12, 3
# file:/prog.c::18, 14
# [libc-start-main]