https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89961
xaizek <xaizek at posteo dot net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |xaizek at posteo dot net --- Comment #11 from xaizek <xaizek at posteo dot net> --- > Closing this as fixed. This isn't fixed. I don't think the problem was actually understood. Say you have: * src/myclass.o * tests/myclass.o If you run `gcov -p -x --json-format src/myclass.o` you get myclass.gcov.json.gz for that file, running `gcov -p -x --json-format tests/myclass.o` gives you myclass.gcov.json.gz for the test. Running `gcov -p -x --json-format src/myclass.o tests/myclass.o` gives myclass.gcov.json.gz *FOR THE TEST ONLY*, because gcov created output for src/myclass.o and then replaced it. >From reading your comment I thought that maybe gcov combines information from two files before writing the result to address this issue, but it doesn't. Results you get depends on the order in which files are specified. Either -p and -x need to be obeyed or reports need to be merged. If combining is implemented, might as well combine all reports and write a single file specified on command line (--json-format=myfile.gz or --json-format=- (no compression needed)).