memcpy() inlining and alignment

Geoff Keating geoffk@cygnus.com
Fri Mar 3 17:37:00 GMT 2000


"Martin v. Loewis" <martin@loewis.home.cs.tu-berlin.de> writes:

> There is no mentioning of alignment constraints, and it says that it
> is copying characters. So I think the compiler is wrong in assuming
> that it can inline the memcpy using word-size instructions.

Elsewhere in the C standard it says that

	src = (struct s *)(cp + 1);

is not guaranteed to produce a valid 'struct s *'.  It is at that
point that undefined behaviour is invoked, after which anything can
happen.

-- 
- Geoffrey Keating <geoffk@cygnus.com>


More information about the Gcc-bugs mailing list