This is the mail archive of the
mailing list for the binutils project.
Re: mips address+symbol issue.
At 23 Jan 2004 16:20:27 -0500, Ian Lance Taylor wrote:
> (My understanding is that the C standard doesn't even permit you to
> form the address of an out-of-bounds array access. Doing so moves you
> out of the range of standardized behaviour, and no promises are made.)
FWIW, looking at the test case, and not being a language lawyer, i
don't know that it *does* form the address of an out-of-bounds array
the test case is:
char a = "deadbeef";
acc_a (long i)
if (acc_a (2000000000L) != 'd')
Two ways to interpret this, i guess:
tmp = i - 2000000000L;
tmp = &a[-2000000000L];
return *(tmp + i); // or just: return tmp[i];
I'd suspect the former is what the order of operations would require,
but the latter is what the compiler's emitting as assembly code.