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

            Bug ID: 114203
           Summary: Miscompilation: A possible miscompilation in GCC 13
                    and 14 with option -Os
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 141242068 at smail dot nju.edu.cn
  Target Milestone: ---

The reproduce link: https://gcc.godbolt.org/z/T48jbo5e7

The reproducer (diff: `gcc-14 -O0` and `gcc-14 -Os`):
```
int foo (unsigned char b) {
    int c = 0;

    while (b) {
        b >>= 1;
        c++;
    }

    return c;
}

int main()
{
  if (foo(0) != 0)
    __builtin_abort ();
  return 0;
}
```

I have sanitized this program using ubsan and asan, ubsan and asans outputs
nothing, so I think this is likely a miscompilation bug.

Reply via email to