[arm-gnu] an long long problem

Richard Earnshaw Richard.Earnshaw at arm.com
Fri Mar 23 09:56:06 UTC 2012


On 22/03/12 16:13, zzzh.2007 wrote:
> Hi, all,
>
> I am using sourcery_g++_lite_for_arm_eabi ( version of
> arm-2008q3-66-arm-none-eabi) in Contiki to do some programming, and
> below is my code that have problem:
>
> -----------------------------------------------
> short a,x;
> long long y;
>
> a = (short)rand();
> x = (short)rand() *10000/66536;
>
> y = a*x*x;
>
> printf( "a and x are %d, %d \n", a, x);
> printf( " y is: %lld \n", y);
>
> ----------------------------------------------
> The problem is: the y result is always wrong.
>
> I have no idea why this is happening, any help?
>
> ------------------------------------------------------------------------
> Zhu
> 2012-03-22
>
> ATT00001..txt
>
>
> _______________________________________________
> arm-gnu mailing list
> arm-gnu at codesourcery.com
> http://sourcerytools.com/cgi-bin/mailman/listinfo/arm-gnu

The most likely reason is that your stack is not correctly aligned.

Why that might be the case you'll have to look into in more detail,
there could be more than one reason.  It might be that your startup code
is incorrect; or it might be that your code is running in an interrupt
context in cortex-m3 and you haven't correctly arranged for the stack to
be re-aligned either by the hardware or the software.

R.

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.




More information about the arm-gnu mailing list