NO

Author Topic: Compiler flaw when optimizing  (Read 2466 times)

George99

  • Guest
Compiler flaw when optimizing
« on: June 05, 2011, 05:23:20 PM »
Code: [Select]
#include <stdio.h>

unsigned testfunc(unsigned n){
return n;
}

void test(unsigned n, unsigned min)
{
unsigned i = 0;
while (n >= min) {
n = testfunc(n);
if (++i > 100)
printf("i greater than 100\n");
}
}

int main(){
test(100,0);
}

This small piece of code should repeat printing "i greater than 100" but by setting any optimization level will stuck.
The problem is the "jnz"-Opcode for testing i against zero.

Tested eith 32bit RC4 6.50
« Last Edit: June 05, 2011, 05:25:30 PM by George99 »