ARM Technical Support Knowledge Articles

POINTER ALIAS PROBLEMS

Applies to: C251 C Compiler

Answer

QUESTION

C251 Version 2.12f generates incorrect code for the following example program:

void main (void)
    {
    unsigned short near Number;

    Number = 1;
    ChangeLocal (&Number);
    Number++;
    }

Specifically, the Number++ statement changes Number to 2 instead of incrementing it. Is there a fix for this problem?

ANSWER

Yes. There is a correction for this problem.

In early versions of C251 Version 2, optimizations involving pointer aliases were too aggressive and optimized necessary code out of the program. This has been corrected in C251 Version 2.14b. Contact our technical support staff to receive the updated C251 compiler via e-mail.

Article last edited on: 2004-05-24 20:35:32

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential