https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101359
Bug ID: 101359 Summary: wrong coverage for a compound statement Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: byone.heng at gmail dot com CC: marxin at gcc dot gnu.org Target Milestone: --- $./gcc -v Using built-in specs. COLLECT_GCC=./gcc COLLECT_LTO_WRAPPER=/home/x/project/gcc/build/install/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --prefix=/home/x/project/gcc/build/install --enable-checking=release --enable-languages=c,c++ --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.0.0 20210105 (experimental) (GCC) $cat test.c const unsigned int true_var = 1; static const short int false_var = 0; typedef double v2df __attribute__((vector_size (16))); static v2df __attribute__((noinline)) bar (v2df a) { return a + (v2df){ 3.0, 3.0 }; } v2df __attribute__((noinline)) foo (v2df y) { return y + bar (y); } int main (void) { int success; union { v2df v; double d[2]; } u; u.v = foo ((v2df){ 5.0, 5.0}); success = (u.d[0] == 13.0 && u.d[1] == 13.0); return !success; } $gcc -O0 --coverage test.c;./a.out;gcov test;cat test.c.gcov -: 4:const unsigned int true_var = 1; -: 5:static const short int false_var = 0; -: 6: -: 7:typedef double v2df __attribute__((vector_size (16))); -: 8: -: 9:static v2df __attribute__((noinline)) 1: 10:bar (v2df a) -: 11:{ 1: 12: return a + (v2df){ 3.0, 3.0 }; -: 13:} -: 14: -: 15:v2df __attribute__((noinline)) 1: 16:foo (v2df y) -: 17:{ 1: 18: return y + bar (y); -: 19:} -: 20: -: 21:int 1: 22:main (void) -: 23:{ -: 24: int success; -: 25: union { -: 26: v2df v; -: 27: double d[2]; -: 28: } u; -: 29: 1: 30: u.v = foo ((v2df){ 5.0, 5.0}); 2: 31: success = (u.d[0] == 13.0 1*: 32: && u.d[1] == 13.0); -: 33: 1: 34: return !success; -: 35:} Line 31 should be executed one time.