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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
b -= n < (uint32_t)(100000);

Can produce undefined behavior. because now you are doing `work-1` which is
before the array.

```
static constexpr void foo(uint64_t n, char* b)
{
    uint64_t f0 = 429497 * n;

    b[0] = fd[f0 >> 32][0];
    b[1] = fd[f0 >> 32][1];
    b[2 - (n < (uint32_t)(100000))] = '9';
}
```

Is the fix to the code.

Reply via email to