-
Notifications
You must be signed in to change notification settings - Fork 161
Open
Description
Summary
Running shecc under Valgrind reports reproducible definite leaks in the compiler driver, even for a minimal input program.
This appears to come from:
- heap-allocated
token_stream_tobjects ingen_file_token_stream()/gen_libc_token_stream() - heap-allocated predefined
macro_tobjects inpreprocess() - cached source buffers stored in
SRC_FILE_MAPwhose values are not released before freeing the hashmap
Reproduction
Minimal input:
int main(void)
{
return 0;
}Command:
cat > /tmp/shecc-minimal.c <<'EOF'
int main(void)
{
return 0;
}
EOF
valgrind \
--tool=memcheck \
--leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
./out/shecc --no-libc -o /tmp/minimal.elf /tmp/shecc-minimal.cThe same issue is also reproducible without --no-libc, but --no-libc shows that the leak is not caused by <stdio.h> or other libc usage.
Observed result
Valgrind reports:
definitely lost: 512 bytes in 6 blocksindirectly lost: 34 bytes in 1 blocks
Expected result
definitely lost and indirectly lost should both be 0 for this minimal run.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels