My machine is running 64bit Ubuntu, and GCC was configured with this line: /opt/v850/gcc-4.4.4/configure --target=v850-elf --enable-targets=all --prefix=/opt/v850 --disable-multilib --enable-languages=c --without-headers --disable-nls --disable-threads --disable-shared --disable-libmudflap --disable-libssp --disable-libgomp --disable-decimal-float --enable-checking=release The build command used is: v850-elf-gcc -nostdlib -nostartfiles -nodefaultlibs -save-temps ctest.c -c -o ctest.v850.o There were no warnings or other output I built a bit of code containing a simple for loop that increments a number from 0 to 8, and the assembly generated uses BLE for branching if the condition is met. The proper instruction to generate would be BGE, since we want to run the body of the code while 7 >= iterator, whereas it currently checks if 7 <= iterator.
Created attachment 21540 [details] the .i file
I tested both 4.4.4 and 4.4.0 and they both generate the wrong code.
This actually appears to be the same problem when comparing in the other direction as well. If I change the source from i < 8 to i > 8, then it uses ``cmp 8, iter; bgt 0xf00'', which is also wrong, since we want 8 < iterator, not 8 > iterator.
I have just come back to this, and it appears that the correct code was being generated in the first place. I must have misread the datasheet or something. In any case, this is now resolved.
Sorry for bumping this bug yet again, but it appears as if it really is generating incorrect code. After looking at several other code which has been verified to run, and reviewing the datasheet heavily, it appears GCC is truly generating incorrect code. For all branches, the direction of the compare is incorrect; e.g., BGE should be BLE, BNL should be BNH, BLT should be BGT.
This bug appears to have been fixed somewhere between 4.4.4 and 4.5.3, so this bug can be closed.