Re: [arm-gnu] bug or me doing something wrong?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [arm-gnu] bug or me doing something wrong?
- To: Gene Smith <gds@xxxxxxxxxxxxx>
- Subject: Re: [arm-gnu] bug or me doing something wrong?
- From: Daniel Jacobowitz <dan@xxxxxxxxxxxxxxxx>
- Date: Fri, 12 Feb 2010 13:21:04 -0500
On Fri, Feb 12, 2010 at 12:20:57PM -0500, Gene Smith wrote:
> 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.)
That'll be where the problem is. Generally values in registers are
either sign or zero extended, not don't-care.
--
Daniel Jacobowitz
CodeSourcery