| 1 |
/* PR ipa/96394 */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
|
| 4 |
typedef struct _entry { |
| 5 |
int has_next; |
| 6 |
int next_ix; |
| 7 |
int count; |
| 8 |
} entry; |
| 9 |
|
| 10 |
extern entry table[]; |
| 11 |
|
| 12 |
void * |
| 13 |
__attribute__((noipa)) |
| 14 |
PyErr_Format(entry * e){ return 0; } |
| 15 |
|
| 16 |
void ae(entry *); |
| 17 |
int h(entry *); |
| 18 |
int ap(entry *); |
| 19 |
int ag(entry *); |
| 20 |
|
| 21 |
int ag(entry *j) { |
| 22 |
if (j->has_next) |
| 23 |
h(&table[j->next_ix]); |
| 24 |
return 0; |
| 25 |
} |
| 26 |
static int ai(entry *j, int k(entry *), int l, int m) { |
| 27 |
int am = 1; |
| 28 |
int ab; |
| 29 |
|
| 30 |
/* k is either 'h' or 'ap': 50%/50% */ |
| 31 |
ab = k(j); |
| 32 |
|
| 33 |
/* loop never gets executed on real data */ |
| 34 |
for (; j->count >= 2; am += 2) |
| 35 |
if (l) { |
| 36 |
entry *i = &table[am + m]; |
| 37 |
PyErr_Format(i); |
| 38 |
} |
| 39 |
return ab; |
| 40 |
} |
| 41 |
void |
| 42 |
__attribute__((noipa)) |
| 43 |
bug() { |
| 44 |
h(table); |
| 45 |
h(table); |
| 46 |
} |
| 47 |
int h(entry *j) { return ai(j, ap, 4, 5); } |
| 48 |
int ap(entry *j) { return ai(j, ag, 14, 4); } |
| 49 |
|
| 50 |
int main(void) |
| 51 |
{ |
| 52 |
bug(); |
| 53 |
} |
| 54 |
|
| 55 |
entry table[2] = { |
| 56 |
{ .has_next = 1 |
| 57 |
, .next_ix = 1 |
| 58 |
, .count = 0 |
| 59 |
}, |
| 60 |
{ .has_next = 0 |
| 61 |
, .next_ix = 0 |
| 62 |
, .count = 0 |
| 63 |
}, |
| 64 |
}; |