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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2025-10-03
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>wich performs an operation equivalent to: __builtin_memmove (a+2, a+1, 4).


Actually it is worse the other part of the test is just garbage.

But the problem is here:
      /* Emit the "backwards" unrolled loop.  */
      emit_move_loop (src, dst, mode, size_bytes, -inc, iters, remainder);

There is an off by one error here for the offset. It should be size_bytes - 1.

Even this produces wrong code:
```
void foo (char *a, char *b)
{
  __builtin_memmove (a, b, 4);
}
```

Reply via email to