| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-ftrapv -mcpu=ev4" } */ |
| 3 |
|
| 4 |
typedef struct tnode_t { |
| 5 |
struct tnode_t *tn_left, *tn_right; |
| 6 |
int v_quad; |
| 7 |
} tnode_t; |
| 8 |
|
| 9 |
int constant_addr(const tnode_t *, long *); |
| 10 |
int constant_addr(const tnode_t *tn, long *offsp) |
| 11 |
{ |
| 12 |
long offs1 = 0, offs2 = 0; |
| 13 |
|
| 14 |
if (tn->v_quad > 0) { |
| 15 |
offs1 = tn->v_quad; |
| 16 |
return 0; |
| 17 |
} else if (tn->v_quad > -1) { |
| 18 |
offs2 = tn->tn_right->v_quad; |
| 19 |
if (!constant_addr(tn->tn_left, &offs1)) |
| 20 |
return 0; |
| 21 |
} else { |
| 22 |
return 0; |
| 23 |
} |
| 24 |
*offsp = offs1 + offs2; |
| 25 |
return 1; |
| 26 |
} |