This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Serious code generation/optimisation bug (I think)


Ross Smith wrote:

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.

That's not quite the story. It's not a bug, it just means that the vector table at location zero is not a legitimate object from C's point of view. You might be able to fool incorrect C code into accessing it, but strictly the result of this decision is that you have to use machine language to access this table (which is not so unreasonable, any code accessing this table will presumably be highly machine dependent).

It might be a good idea to make null be other than zero, but I
somewhat suspect that in practice incorrect C code may well
assume that null is zero in various contexts, since this
expectation is rather strongly ingrained from experience.

(sort of like implementing local variables on a stack for fortran-77.
The standard was carefully written to accomodate this, but many fortran
programs assumed static allocation, and in fact one of the reasons that
fortran was annoying on the B5500 was that it used an Algol-60 like
stack implementation -- not surprising given the architecutre -- and
although this was correct, it caused many existing fortran programs
to fail).

-- Ross Smith


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]