[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#325670: gcc-4.0: regression: generates wrong code for inlined memcpy




Steve Langasek <vorlon@debian.org>, 325670@bugs.debian.org schrieb am 30.08.05 09:49:30:

> When passing pointers to 4-byte types to memcpy(), gcc-4.0 generates
> wrong code which assumes that these pointers are aligned at 4-byte
> boundaries for purposes of optimization, ignoring the implicit cast to
> (char *) in the prototype of memcpy().

If a pointer points to an object that requires an alignment, then gcc can of
course assume this alignment in the pointer. Later casting or passing of this
pointer does not change this fact. If the pointer isn't actually aligned
correctly for the object, then the error is already there (on the user's part),
and the behaviour of memcpy is a red herring. So this is not a gcc bug.




Reply to: