https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121063
Bug ID: 121063 Summary: [GCOV] dead "return;" was marked as executed. 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) $ cat test.c #include <errno.h> #include <inttypes.h> #include <stdlib.h> #include <stdio.h> void example_func(int x) { static int count = 0; if (x <= 0) return; char buffer[32]; int result = strfromd(buffer, sizeof(buffer), "%g", x * 1.5); if (result != 0) { errno = EINVAL; return; } } int main(void) { example_func(2); return 0; } $ cat test.c.gcov -: 1:#include <errno.h> -: 2:#include <inttypes.h> -: 3:#include <stdlib.h> -: 4:#include <stdio.h> 1: 5:void example_func(int x) { -: 6: static int count = 0; 1: 7: if (x <= 0) 1*: 8: return; -: 9: char buffer[32]; 1: 10: int result = strfromd(buffer, sizeof(buffer), "%g", x * 1.5); 1: 11: if (result != 0) { 1: 12: errno = EINVAL; 1: 13: return; -: 14: } -: 15:} 1: 16:int main(void) { 1: 17: example_func(2); 1: 18: return 0; -: 19:} Line 8 should not be executed.