1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
struct foo { char placeholder[5]; }; void * test (const char *str) { struct foo *p = __builtin_malloc(sizeof(struct foo)); if (!p) return p; __builtin_memset(p, 0, sizeof(*p)); static int s = 1; __atomic_store_n(&s, 0, 0); return p; }