From mboxrd@z Thu Jan 1 00:00:00 1970 From: Haavard Skinnemoen Date: Sat, 24 Nov 2007 22:20:14 +0100 Subject: [U-Boot-Users] cramfs voodoo Message-ID: <20071124222014.1fe26fcd@siona> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Does anyone know why the following deep voodoo magic in include/cramfs/cramfs_fs.h is needed? #define CRAMFS_GET_NAMELEN(x) (((u8*)(x))[8] & 0x3f) #define CRAMFS_GET_OFFSET(x) ((CRAMFS_24(((u32*)(x))[2] & 0xffffff) << 2) |\ ((((u32*)(x))[2] & 0xc0000000) >> 30)) #define CRAMFS_SET_NAMELEN(x,y) (((u8*)(x))[8] = (((0x3f & (y))) | \ (0xc0 & ((u8*)(x))[8]))) #define CRAMFS_SET_OFFSET(x,y) (((u32*)(x))[2] = (((y) & 3) << 30) | \ CRAMFS_24((((y) & 0x03ffffff) >> 2)) | \ (((u32)(((u8*)(x))[8] & 0x3f)) << 24)) It looks like a workaround for buggy bitfield handling in the compiler, but newer versions of gcc are not@all happy with it and spews warnings like this: cramfs.c:82: warning: dereferencing type-punned pointer will break strict-aliasing rules which indicates that the generated code is probably wrong. Can we get rid of it somehow? Haavard