Hi Dimitry, run the software below and at the end you get x=1 (should be 0!!)
It seems that gcc uses the flags of sub for the next if(); but it should do a additional cmp !! (first it is a unsigned operation, then a signed) msp430-gcc main.c -mmcu=msp430x149 -g -O2 -ffunction-sections -Wl,--gc-sections,-uInterruptVectors -o main.elf (gcc from the download, maybe you have already fixed that bug??) #include <stdlib.h> int x=0; func1(uint a, uint b) { uint ud; int d; ud = a-b; d = ud; if ( d<0 ) x|=1; } func2(uint a, uint b) { volatile uint ud; volatile int d; ud = a-b; d = ud; if ( d<0 ) x|=2; } main() { func1(32768,20000); func2(32768,20000); } Matthias