mips address+symbol issue.

Robert Dewar dewar@gnat.com
Fri Jan 23 22:26:00 GMT 2004


Erik Trulsson wrote:

> Remember that a[i] is just syntactic sugar for *(a+i).

I don't think that's right, I think the intention is that
a[i] is syntactic sugar for *(a+(i)). Nothing else makes
sense. For example you would be saying that you could
not have a subscript of the form x[a==b] since it would
mean *((x+a) == b). That just can't be right.

To me the quoted program is clearly correct, and if it
does not work, it's a compiler bug.

Note that your interpretation would also mean that

    int a[10];
    int x;

    x = 11;
    .. = a[x-2];

would be undefined, and that seems equally implausible.





More information about the Binutils mailing list