https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99443
Bug ID: 99443 Summary: [GCOV] No coverage with "Aborted(core dumped)" Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: njuwy at smail dot nju.edu.cn CC: marxin at gcc dot gnu.org Target Milestone: --- $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.2.0 (GCC) $ cat test.c #include <x86intrin.h> #include <stdio.h> extern void abort(void); #ifdef __x86_64__ #define EFLAGS_TYPE unsigned long long int #else #define EFLAGS_TYPE unsigned int #endif int main() { printf("1\n"); EFLAGS_TYPE flags = 0xD7; /* 111010111b */ __writeeflags(flags); flags = __readeflags(); printf("2\n"); if ((flags & 0xFF) != 0xD7) abort(); printf("3\n"); #ifdef DEBUG printf("PASSED\n"); #endif } $ gcc -O0 --coverage test.c;./a.out;gcov test;cat test.c.gcov 1 2 Aborted (core dumped) test.gcda:cannot open data file, assuming not executed File 'test.c' Lines executed:0.00% of 8 Creating 'test.c.gcov' File '/usr/local/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include/ia32intrin.h' Lines executed:0.00% of 3 Creating 'ia32intrin.h.gcov' -: 0:Source:test.c -: 0:Graph:test.gcno -: 0:Data:- -: 0:Runs:0 -: 1:#include <x86intrin.h> -: 2:#include <stdio.h> -: 3: -: 4:extern void abort(void); -: 5: -: 6:#ifdef __x86_64__ -: 7:#define EFLAGS_TYPE unsigned long long int -: 8:#else -: 9:#define EFLAGS_TYPE unsigned int -: 10:#endif -: 11: #####: 12:int main() { #####: 13: printf("1\n"); #####: 14: EFLAGS_TYPE flags = 0xD7; /* 111010111b */ -: 15: __writeeflags(flags); #####: 16: flags = __readeflags(); #####: 17: printf("2\n"); #####: 18: if ((flags & 0xFF) != 0xD7) #####: 19: abort(); #####: 20: printf("3\n"); -: 21:#ifdef DEBUG -: 22: printf("PASSED\n"); -: 23:#endif -: 24:} We can see that line #13,#14 were executed,which means that main function executed too. However, no coverage generated.