projects
/
libfirm
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
call optimize_cf() to delete dead-code that might arise after cond_eval
[libfirm]
/
ir
/
be
/
test
/
fehler071.c
1
/*$ -fno-if-conv -fno-inline $*/
2
3
#include <stdio.h>
4
#include <stdlib.h>
5
6
int a = 42;
7
8
int changea(void) {
9
a = 13;
10
return 1;
11
}
12
13
int f2(void) {
14
int t = a;
15
int t2 = changea();
16
int t3 = t + t2;
17
return t3;
18
}
19
20
int f3(int arg) {
21
int t = a + arg;
22
changea();
23
return t;
24
}
25
26
int f(int f) {
27
int t = a;
28
changea();
29
30
/* must not use source address mode (loading from a) for t+1 */
31
if(f > 10000) {
32
return t + 1;
33
}
34
return f + 2;
35
}
36
37
int main(void) {
38
srand(0);
39
printf("Res: %d (should be 43)\n", f(1000000));
40
a = 42;
41
printf("Res2: %d (should be 43)\n", f2());
42
return 0;
43
}