Created attachment 188144 [details] The program under test, its sources, the test file, the log file and the combined coredump SUMMARY Valgrind crashes while checking a program (a C compiler) that is known to be faulty. STEPS TO REPRODUCE 1. Decompress the provided attachment 2. Run `valgrind ./build/main/lilycc test-files/test_compound.c` OBSERVED RESULT Valgrind detects an invalid read and an invalid write, then receives a segmentation fault in its own code. EXPECTED RESULT Valgrind itself should not have received the segmentation fault. SOFTWARE/OS VERSIONS Operating System: Arch Linux KDE Plasma Version: 6.5.4 KDE Frameworks Version: 6.21.0 Qt Version: 6.10.1 Kernel Version: 6.12.62-1-lts (64-bit) Graphics Platform: Wayland Processors: 8 × 11th Gen Intel® Core™ i5-1135G7 @ 2.40GHz Memory: 40 GiB of RAM (39.0 GiB usable) Graphics Processor: Intel® Iris® Xe Graphics ADDITIONAL INFORMATION The program in question can also be found at https://github.com/robotman2412/lily-cc however there are uncommitted changes in my working tree (thus the sources included in the attachment).
Memcheck has detected a bug in your code. After that, especially invalid writes, anything can happen. We do not make any promises that Valgrind will be able to continue in a correct manner. The same is true for all dynamic analysis tools as far as I know. What you can do is increase the redzone size, e.g., valgrind --redzone-size=128 ./build/main/lilycc test-files/test_compound.c That is the amount of slop that Valgrind adds surrounding each heap allocation. That makes it more robust in the face of invalid writes. I'm closing this as not a bug. If you fix the bug in your code and the segfault is still there please reopen this report.