https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83989
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-01-23
Ever confirmed|0 |1
--- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Here's a more minimal version:
/* compile with: -O2 -Wrestrict */
__attribute__((__malloc__)) extern void *my_malloc(__SIZE_TYPE__ n);
#define SIZE 32
void test (void)
{
void *recmem = __builtin_malloc(SIZE);
while (1)
{
void *oldrecmem = recmem;
recmem = __builtin_malloc(SIZE);
__builtin_memcpy(recmem, oldrecmem, SIZE);
}
}
void test_2 (void)
{
void *recmem = my_malloc(SIZE);
while (1)
{
void *oldrecmem = recmem;
recmem = my_malloc(SIZE);
__builtin_memcpy(recmem, oldrecmem, SIZE);
}
}