commtech: BUGFIX unwanted optimization

Replace prod += 42 by prod += fourty_two where fourty_two is a volatile
variable to avoid replacement of the loop into a prod += 42 * nb_loop
This commit is contained in:
Thomas Preud'homme 2009-07-01 02:34:50 +02:00 committed by Thomas Preud'homme
parent 243d8810f1
commit 7a1610961c
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@
static int nb_loop = 0, prod = 0, *prod_ptr = ∏
volatile int fourty_two = 42;
unsigned int seedp;
int init_calc(int param_nb_loop)
@ -17,7 +18,7 @@ void **do_calc(void)
int i;
for(i = 0; i < nb_loop; i++)
prod += 42;
prod += fourty_two;
return (void **) &prod_ptr;
}