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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #4 from Anonymous <iamanonymous.cs at gmail dot com> ---
This bug still reproduces on current GCC trunk. Re-tested with gcc 17.0.0
  (experimental, 2026-11-01); also reproduced on gcc 13.1.0 and 11.4.0.

  Test case (small.c):

      #include <stdlib.h>
      int doit(int sel, int n, void *p)
      {
        int * const p0 = p;

        switch (sel)
        {
          case 0:
            do {*p0 += *p0;} while (--n);
            return *p0 == 0;

          default:
            abort ();
        }
      }

      int main()
      {
        int v0;
        v0 = 1; doit(0, 3, &v0);
        exit (0);
      }

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

  Current output:

              1:    2:int doit(int sel, int n, void *p)
              1:    4:  int * const p0 = p;
              1:    6:  switch (sel)
              3:    8:    case 0:
              3:    9:      do {*p0 += *p0;} while (--n);
              1:   10:      return *p0 == 0;

  Line 8 ("case 0:") is still marked with the wrong count (3), while the case
  label is entered only once from the switch dispatch (the do-while body runs 3
  times, but the label itself executes once). This is the same symptom as the
  original report (the wrong count was 2 back then, now it is 3). Could this be
  reopened and re-examined?
  • [Bug gcov-profile/85332] [GC... iamanonymous.cs at gmail dot com via Gcc-bugs

Reply via email to