https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102720
Stefan Schulze Frielinghaus <stefansf at linux dot ibm.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |stefansf at linux dot ibm.com
--- Comment #4 from Stefan Schulze Frielinghaus <stefansf at linux dot ibm.com>
---
typedef __SIZE_TYPE__ size_t;
extern void* malloc (size_t);
extern void* memset (void*, int, size_t);
__attribute__((noinline))
int test (char *s)
{
int i;
for (i=0; s[i]; ++i);
return i;
}
int main (void)
{
char *p = malloc (1024);
memset (p, 0xf, 1024); // removed
p[1] = 0; // removed
int i = test (p);
if (i != 1)
__builtin_abort ();
return 0;
}
$ gcc -O2 -fdump-tree-dse2-details test.c
In dse2 we then have:
Deleted dead store: MEM[(char *)p_3 + 1B] = 0;
Deleted dead call: memset (p_3, 15, 1024);
prior g:008e7397dad971c03c08fc1b0a4a98fddccaaed8 the store and call is not
removed.