From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,a35cb6e146fc5072,start X-Google-Attributes: gidfee84,public From: Aurel Balmosan Subject: unaligned access messages from the kernel increases from 4.0b 4.0d to 4.0e. Why? Date: 2000/01/05 Message-ID: <3873473F.E46D6F03@orga.com>#1/1 X-Deja-AN: 568632765 X-Nntp-Posting-Host: 192.168.14.45 Content-Transfer-Encoding: 7bit Sender: news@orga.com (News Administrator) X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: ORGA Kartensysteme GmbH Mime-Version: 1.0 Newsgroups: comp.unix.osf.osf1 Hi, We noticed those warning messages the first time in 4.0d. There it was obvious. Now in 4.0e it is not obvious anymore. What we do frequently is following: We have a large buffer. We define a structure. The structure is filled with some data and an extended byte string. We put the next structure exactly behind the last byte of the byte string. So this structure might or might not be aligned anymore. No problem. For that we use memcpy() to fill in the data. Now on 4.0e the memcpy(&structure->lrc, &lrc, 1) generates an unaligned access. Sure that the pointer to structure->lrc is unaligned but for that we use memcpy()! We solved the unaligned access warning from the kernel by writing our own Smemcpy() which the copy the source byte by byte in a loop. For me it looks like if the compiler though away the memcpy and make it diffrently. All the castings we tried didn't work out. Is there an official way how to handle this or a statement why this was changed in kernel? Regards, Aurel Balmosan