|
|||||||||||
Technical Support Support Resources
Product Information |
C166: Casting a Variable on the Stack to a Code PointerInformation in this article applies to:
SYMPTOMSI have the following function declared:
I want to get a far function pointer to buf and then to call it. The following code doesn't convert the variable address to a function pointer correctly. It appears that the lower 14 bits of the address are loaded into the lower word of the address and the contents of the DPP register are loaded into the upper 16 bits. CAUSEThat is exactly correct. The reason is because far pointers to variables are treated differently than far pointers to program code. RESOLUTIONChange the assignment of buf to func to the following:
and the above program will work correctly. MORE INFORMATION
Last Reviewed: Thursday, February 25, 2021 | ||||||||||
|
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.