Commit daadfb78 authored by Matthias Braun's avatar Matthias Braun
Browse files

improved version of fehler71

[r15580]
parent 62ca7f0e
/*$ -fno-if-conv $*/
/*$ -fno-if-conv -fno-inline $*/
#include <stdio.h>
#include <stdlib.h>
int a = 42;
void changea(void) {
int changea(void) {
a = 13;
return 1;
}
int f2(void) {
int t = a;
int t2 = changea();
changea();
changea();
int t3 = t + t2;
changea();
return t3;
}
int f(int f) {
int t = a;
changea();
/* must not use source address mode (loading from a) for t+1 and t+2 */
/* must not use source address mode (loading from a) for t+1 */
if(f > 10000) {
return t + 1;
}
......@@ -22,6 +33,8 @@ int f(int f) {
int main(void) {
srand(0);
printf("Res: %d\n", f(rand()));
printf("Res: %d (should be 43)\n", f(1000000));
a = 42;
printf("Res2: %d (should be 43)\n", f2());
return 0;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment