|
From: Denis V. D. <de...@nu...> - 2001-06-06 00:55:26
|
Bill Soudan <we...@ri...> writes: > > Description: This patch fixes cast alignment bugs detected by using the > > -Wcast-align option for gcc. Although > > > > *((DWORD*)&buffer[5]) = value; > > > > may work on an intel processor, it is not portable because some > > architechtures (e.g. sparc) cannot copy DWORDS if they are not aligned on > > a multiple of 4 bytes. The attached patch fixes all occurences of such > > statements to: > > > > memcpy(buffer + 5, &value, sizeof(DWORD)); I understand the problem, but I am not sure this is the only way to fix it. > Why doesn't the compiler generate assembly code to just do the copy byte > by byte? Any ideas? :) Good question. > I'll apply the patch of course, just wondering for future reference. No. I'd like to test it first for myself. https://sourceforge.net/tracker/?func=detail&aid=427404&group_id=384&atid=100384 -- Denis V. Dmitrienko | E-mail: de...@de... | ICQ#: 5538614 Home page: http://denix.org | de...@kd... History became legend... Legend became myth. And some things that should not have been forgotten ...were lost. |