On Mon, Dec 15, 2025 at 03:50:16PM -0500, Andrew MacLeod wrote:
> if (memcpy ((char *) buf3 + 4, buf5, n + 6) != (char *) buf1 + 4
> || memcmp (buf1, "aBcdRSTUVWklmnopq\0", 19))
> abort ();
>
> With my changes, this sequence goes from
Sorry, the test has been written without considering returns 1st argument
optimizations.
My preference would be to add some opt_barrier macro or inline function and
use it like
if (memcpy (...) != opt_barrier (&buf1 + 4)
|| memcmp (...) != 0)
abort ();
If inline function, just make it a pass through void * -> void *
__attribute__((noipa)) function, if macro, use
#define opt_barrier(arg) ({ void *ret = arg; __asm ("" : "+g" (arg)); ret; })
or so.
Jakub