News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Compiler flaw when optimizing

Started by George99, June 05, 2011, 05:23:20 PM

Previous topic - Next topic

George99

#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