This is the mail archive of the gcc-patches@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: [patch] rfa: fix problem with reassociating pointer additions


On Mon, 4 Oct 2004, Eric Christopher wrote:
>   z  = (int *) (a + (b + sizeof (c)));
>
> We end up reassociating the constant addition into either
>
> (a+(sizeof (c))) + b or
> (a+b) + sizeof(c).
>
> either could be a problem when dealing with pointer arithmetic near
> the boundaries of addressable memory.

Could you explain how this could be a problem near the boundaries of
addressable memory?  A failing testcase perhaps.

I'll admit that there may be some benefits for preserving REG_POINTER
on hppa and ia64, though we do loose optimizations opportunities due
to non-longer canonicalizing addition trees to always place the constant
at the top-right.  In your example, it should always become "(a+b) + C".

But I think its important to get the motivation for this patch straight,
before deciding to approve or reject it.  There may be some other bug in
the compiler that this change is papering over.

Roger
--


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