[arm-gnu] bug or me doing something wrong?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[arm-gnu] bug or me doing something wrong?



I have a function that accepts a uint16_t parameter. And I have a global variable of type int16_t. They are both set to zero. But inside the function I compare them, if (a==b), and they compare not equal. In the assembly language the compare is actually "cmp r0, r2" where r0 is 0xc000000 and r2 0x0 so they compare not equal.

Note: r2 is the global var and gets setup with ldrh r2, [r3, #4] and it looks correct. while r0 is the function parameter and gets set from r6 at beginning of function and r6 contain 0xc000000. (Don't immediately see where r6 is set.)

Also, should I see a warning about comparing signed to unsigned with -Wall -Wextra --pedantic ?

This is with opt level -0s.

-gene