https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93706

Anonymous <iamanonymous.cs at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iamanonymous.cs at gmail dot 
com

--- Comment #2 from Anonymous <iamanonymous.cs at gmail dot com> ---
This appears to be fixed on current GCC trunk. Re-tested with gcc 17.0.0
(experimental, 2026-11-01):

Test case (small.c):

    static inline __attribute__ ((always_inline)) int foo (unsigned short v)
    {
      return (v << 8) | (v >> 8);
    }

    int main ()
    {
      unsigned short b = 0;
      return foo(b);
    }

    $ gcc -O0 --coverage small.c && ./a.out && gcov small.c

Current output:

            1:    3:  return (v << 8) | (v >> 8);
            1:    9:  return foo(b);

Line 9 ("return foo(b);") is now correctly reported as executed once
(previously 2 with the always_inline attribute). The fix is compiler-side:
the .gcno block-to-line mapping no longer double-attributes the return
statement (verified by running gcov 13.1 vs gcov 17.0.0 on the same
.gcno/.gcda files). Could this be confirmed and closed as fixed?

Reply via email to