Re: gcc builtin memcpy is bogus?

From: David Mosberger <>
Date: 2003-12-09 04:29:03
>>>>> On Mon, 8 Dec 2003 16:01:24 +0000, Matthew Wilcox <> said:

  Matthew> This is a fun one ... I don't know what to blame for this.

  Matthew> struct rfd {
  Matthew>   u16 status;
  Matthew>   u16 command;
  Matthew>   u32 link;
  Matthew>   u32 rbd;
  Matthew>   u16 actual_size;
  Matthew>   u16 size;
  Matthew> };

  Matthew> The kernel doesn't use -fno-builtin or -fno-builtin-memcpy
  Matthew> so it attempts to optimise this by doing 4-byte loads and
  Matthew> stores.  Problem is, the destination is misaligned
  Matthew> (deliberately), so the kernel emits unaligned messages.
  Matthew> Adding -fno-builtin to the command line turns this back
  Matthew> into a call to memcpy.

The code is wrong.  If it's 2-byte aligned, use

	attribute ((packed) (aligned (2))

to mark it as such (check on the syntax of the attributes, I probably
got it wrong).

To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to
More majordomo info at
Received on Mon Dec 8 12:37:42 2003

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:20 EST