This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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: mips64 n32 and n64 support in dl-machine.h


On Mar 14, 2003, Andreas Schwab <schwab at suse dot de> wrote:

> The actual arguments are always generic pointers (or integers cast to it),
> so it would be safe.

I don't understand what you mean.  Consider:

int something;

void f(void*p) {
  memcpy (p, something, sizeof(int));
}

void g(int *q) {
  f(q);
}

If g() is passed a mis-aligned pointer, and f() is inlined into g(),
the optimizer may very well assume that it is safe to write to *q as a
word, instead of as separate bytes.  It doesn't matter that the
pointer passed to f guarantees less alignment: with inlining, the
compiler can see through it.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist                Professional serial bug killer


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