1/* PR rtl-optimization/27616 */
2/* Reported by Lee Ji Hwan <moonz@kaist.ac.kr> */
3/* Testcase by Andrew Pinski <pinskia@gcc.gnu.org> */
4
5struct chunk_s
6{
7  unsigned int size;
8  int offset_next;
9};
10
11typedef struct chunk_s chunk_t;
12
13void foo(chunk_t *first)
14{
15  chunk_t *cur;
16  char *first0;
17
18  do {
19    first0 = (char *) first;
20    cur = (chunk_t *) (first0 + first->offset_next);
21    if ((chunk_t *) (first0 + cur->offset_next) != first)
22      return ;
23
24    first->offset_next = 0;
25
26  } while (cur->size != 0);
27}
28