Keil Logo

ARMCC: WARNING #61-D: INTEGER OPERATION RESULT IS OUT OF RANGE


Information in this article applies to:

  • RealView C Compiler All Versions

QUESTION

I have written the following code:

unsigned int i;
i = (u32)(3<<30);

However this generates a warning:

warning:  #61-D: integer operation result is out of range

Can I avoid this warning somehow?

ANSWER

The compiler overflow warning is correct, because the expression 3<<30 represents a signed int. To avoid the warning, explicitly define the constant 3 as an unsigned value using the U postfix. For example:

unsigned int i;
i = (u32)(3U<<30);

MORE INFORMATION

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Tuesday, March 23, 2010


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.