diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/pr62030.c')
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/pr62030.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr62030.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr62030.c new file mode 100644 index 000000000..b8baf9343 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr62030.c @@ -0,0 +1,50 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +extern void abort (void); + +struct node +{ + struct node *next; + struct node *prev; +}; + +struct node node; + +struct head +{ + struct node *first; +}; + +struct head heads[5]; + +int k = 2; + +struct head *head = &heads[2]; + +static int __attribute__((noinline)) +foo (void) +{ + node.prev = (void *)head; + head->first = &node; + + struct node *n = head->first; + struct head *h = &heads[k]; + struct node *next = n->next; + + if (n->prev == (void *)h) + h->first = next; + else + n->prev->next = next; + + n->next = h->first; + return n->next == &node; +} + +int +main (void) +{ + if (foo ()) + abort (); + return 0; +} |