summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/compile/pr16808.c
blob: 28527de5db13a0e39944cf36a3f243b9cc773ef8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* We used to ICE as we did not mark a Vop for rename as
   we changed a function call to a normal modify statement
   while folding exp(0.0); */

double exp(double);
void f0(void);
void f(double);
typedef struct Parser {
    int x;
    char *s;
} Parser;
static double pop(Parser *p) {
    if (p->s[0] <= 0) {
	f0();
	return 0;
    }
    --p->x;
    return 0;
}
static void evalFactor(Parser *p) {
    while (p->x)
	f(exp(pop(p)));
}
static void evalTerm(Parser *p) {
    while (p->s[0])
	evalFactor(p);
}
static void evalExpression(Parser *p) {
    evalTerm(p);
    while (p->s[0])
	evalTerm(p);
}
void evalPrimary(Parser *p) {
    if (p->s)
	return;
    evalExpression(p);
}