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] builtins.c, fold-const.c: Don't create type


On Saturday 16 April 2005 23:33, John David Anglin wrote:
> > > Steven Bosscher
> > >
> > >> On Saturday 16 April 2005 16:36, Roger Sayle wrote:
> > >> Converting "ptr + strlen(ptr)" into "ptr + (char*)strlen(ptr)" in
> > >> builtins.c, just appears a little strange at first sight.
> > >
> > > Why does this appear strange?  It just makes the semantics of
> > > pointer addition explicit.
>
> It appears strange.  If I encounter this in the backend, the result
> has to be loaded into a register and we probably loose an opportunity
> to do an indexed load or store.

On IRC, Chris Lattner mentioned (if I understood him correctly) that in
LLVM this kind of pointer arithmetic doesn't exist, and that instead it
is converted to "regular" integer arithmatic by casting the pointer to
intptr_t (instead of casting the integer to a pointer).  Would that be
a better solution for GCC too, perhaps?

Gr.
Steven


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