https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97917
Bug ID: 97917
Summary: [GCOV]incorrect code coverage for intrinsics
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: gcov-profile
Assignee: unassigned at gcc dot gnu.org
Reporter: yangyibiao at outlook dot com
CC: marxin at gcc dot gnu.org
Target Milestone: ---
$ cat test.c
#include <x86intrin.h>
typedef double D __attribute__((may_alias));
__attribute__((aligned(16))) static const double r[4] = { 1., 5., 1., 3. };
__attribute__((noinline, noclone))
void foo (int x) { return; }
int main ()
{
__m128d t = _mm_set1_pd (5.);
((D *)(&t))[0] = 1.;
foo (_mm_movemask_pd (_mm_cmpeq_pd (t, _mm_load_pd (&r[0]))));
return 0;
}
$ gcc -O0 --coverage test.c; ./a.out; gcov test.c; cat test.c.gcov
File 'test.c'
Lines executed:100.00% of 6
Creating 'test.c.gcov'
File '/usr/gcc-trunk/lib/gcc/x86_64-pc-linux-gnu/10.0.1/include/emmintrin.h'
Lines executed:100.00% of 4
Creating 'emmintrin.h.gcov'
-: 0:Source:test.c
-: 0:Graph:test.gcno
-: 0:Data:test.gcda
-: 0:Runs:1
-: 1:#include <x86intrin.h>
-: 2:
-: 3:typedef double D __attribute__((may_alias));
-: 4:__attribute__((aligned(16))) static const double r[4] = { 1.,
5., 1., 3. };
-: 5:
-: 6:__attribute__((noinline, noclone))
1: 7:void foo (int x) { return; }
-: 8:
1: 9:int main ()
-: 10:{
1: 11: __m128d t = _mm_set1_pd (5.);
1: 12: ((D *)(&t))[0] = 1.;
3: 13: foo (_mm_movemask_pd (_mm_cmpeq_pd (t, _mm_load_pd
(&r[0]))));
1: 14: return 0;
-: 15:}
############################
Line #13 is wrongly marked as executed 3 times.
When debug this program in gdb, Line #13 is hit only once.