------- Comment #4 from rguenth at gcc dot gnu dot org 2006-09-29 09:14 ------- Here's an executable testcase which is miscompiled at the tree-level.
extern void abort(void); struct Foo { int a; int b; }; struct Node; struct Node { struct Node *next; }; struct Node *pool; void grow (void) { char *mem = __builtin_malloc (4096); struct Node *node = (struct Node *)mem; struct Foo *foo; __builtin_memcpy (&node->next, &pool, sizeof(struct Node*)); pool = node; } static inline void *alloc_one (void) { struct Node *node = pool; __builtin_memcpy (&pool, &node->next, sizeof(struct Node*)); return node; } static inline void dealloc_one (void *p) { struct Node *node = p; __builtin_memcpy (&node->next, &pool, sizeof(struct Node*)); pool = node; } int main() { grow(); struct Foo* foo = alloc_one(); foo->a = 0; foo->b = -1; dealloc_one (foo); if (foo->b == -1) abort (); return 0; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29272