https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90865
Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to sshannin from comment #0) > Code compiled with gcov and ubsan produces bad coverage results. It seems > that ubsan inserts some branches which are visible to gcov as part of its > instrumentation. > > In the following snippet below you can observe that gcov has flagged "int > res = 5 / argc;" as containing uncovered branches (checking for division by > 0?). Yes, it's expected behavior: argc.0 = argc; _1 = argc.0 == 0; _2 = _1; if (_2 != 0) goto <D.2285>; else goto <D.2286>; <D.2285>: _3 = (unsigned long) argc.0; __builtin___ubsan_handle_divrem_overflow (&*.Lubsan_data0, 5, _3);