https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121186
Bug ID: 121186 Summary: [GCOV] Executed conditional expression is wrongly marked as unexecuted. Product: gcc Version: 16.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 Target Milestone: --- gcc version: gcc version 16.0.0 20250704 (experimental) (GCC) option: --coverage -std=c2x $ cat test.c #include <stddef.h> #include <stdlib.h> #include <stdio.h> _BitInt(8) a; static inline __attribute__((__always_inline__)) void bar(int x0, int x1, int x2, int x3, int x4, int x5, int x6, int x7) { _BitInt(65535) b = 0; _BitInt(383) c = (x0 + x1 * 2 + x2 * 3) % 42; if (x3 || (x4 && x5)) b += 1ULL << (c % 64); for (_BitInt(16) i = 0; i < 16; ++i) { b ^= ((b >> i) & 1); } a = (_BitInt(8))((b ^ c) & 0xFF); } int main(void) { const int args[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; bar(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]); printf("Final value of a: %d\n", (int)a); return EXIT_SUCCESS; } $ cat test.c.gcov -: 1:#include <stddef.h> -: 2:#include <stdlib.h> -: 3:#include <stdio.h> -: 4:_BitInt(8) a; -: 5:static inline __attribute__((__always_inline__)) void bar(int x0, int x1, int x2, int x3, -: 6: int x4, int x5, int x6, int x7) -: 7:{ 1: 8: _BitInt(65535) b = 0; 1: 9: _BitInt(383) c = (x0 + x1 * 2 + x2 * 3) % 42; #####: 10: if (x3 || (x4 && x5)) 1: 11: b += 1ULL << (c % 64); 17: 12: for (_BitInt(16) i = 0; i < 16; ++i) { 16: 13: b ^= ((b >> i) & 1); -: 14: } 1: 15: a = (_BitInt(8))((b ^ c) & 0xFF); 1: 16:} -: 17: 1: 18:int main(void) -: 19:{ -: 20: const int args[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; 1: 21: bar(args[0], args[1], args[2], args[3], 1: 22: args[4], args[5], args[6], args[7]); 1: 23: printf("Final value of a: %d\n", (int)a); 1: 24: return EXIT_SUCCESS; -: 25:} cov of line 10 should be 1.