Serious code generation/optimisation bug (I think)
Andy Armstrong
andy@hexten.net
Fri Jan 30 11:36:00 GMT 2009
On 30 Jan 2009, at 05:11, Ross Smith wrote:
> Zoltán Kócsi wrote:
>> On Thu, 29 Jan 2009 08:53:10 +0000
>> Andrew Haley <aph@redhat.com> wrote:
>>> We're talking about gcc on ARM. gcc on ARM uses 0 for the null
>>> pointer constant, therefore a linker cannot place an object at
>>> address zero. All the rest is irrelevant.
>> Um, the linker *must* place the vector table at address zero, because
>> the ARM, at least the ARM7TDMI fetches all exception vectors from
>> there. Dictated by the HW, not the compiler.
>
> This sounds like a genuine bug in gcc, then. As far as I can see,
> Andrew is right -- if the ARM hardware requires a legitimate object
> to be placed at address zero, then a standard C compiler has to use
> some other value for the null pointer.
The ARM exception table looks like this:
0x00000000 Reset
0x00000004 Undefined instruction
0x00000008 Software interrupt
0x0000000C Prefetch Abort
0x00000010 Data Abort
0x00000014 Reserved
0x00000018 IRQ
0x0000001C FIQ
so only the reset vector is at 0.
--
Andy Armstrong, Hexten
More information about the Gcc
mailing list