From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,a35cb6e146fc5072 X-Google-Attributes: gidfee84,public From: Joe Mario Subject: Re: unaligned access messages from the kernel increases from 4.0b 4.0d to 4.0e. Why? Date: 2000/01/05 Message-ID: <38737F19.1B9D8A37@zk3.dec.com>#1/1 X-Deja-AN: 570448348 Content-Transfer-Encoding: 7bit References: <3873473F.E46D6F03@orga.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: iass@lead.zk3.dec.com X-Trace: lead.zk3.dec.com 947093291 17325 16.141.0.18 (5 Jan 2000 17:28:11 GMT) Organization: UBPG Mime-Version: 1.0 NNTP-Posting-Date: 5 Jan 2000 17:28:11 GMT Newsgroups: comp.unix.osf.osf1 Aurel Balmosan wrote: > 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. > The V4.0e compiler is generating an inline code sequence to do the memcpy(). You can get rid of the unaligned access errors in several ways. 1) Add "#pragama function (memcpy)" to your source code prior to the memcpy() call. This will cause the compiler to generate a call to the memcpy() function. 2) Add a cast with __unaligned to your memcpy call. For example, if structure is of type foo: memcpy( (__unaligned struct foo *)&structure->lrc, &lrc, 1) ; 3) Add "-nointrinsics" to your cc command line. This will work but will degrade performance for all calls that could be compiler intrinsics. I'd recommend using the __unaligned cast. Joe Mario Compaq Tru64 Development Environment