Hi Chris, > On Sun, 12 Oct 2025 23:04:03 +0800 > Chris Billington <[email protected]> wrote: > > > > Compilation warnings > > > > OpenBSD uses clang as default compiler. Both before and after the > > patch, it emits -Wcast-align warnings for each use of the macros WORD, > > DWORD and QWORD defined in type.h, about 300 in total. > > > > Example: > > > > dmidecode.c:612:26: warning: cast from 'const u8 *' (aka 'const > > unsigned char *') to 'const u16 *' (aka 'const unsigned short *') > > increases required alignment from 1 to 2 [-Wcast-align] > > pr_list_item("0x%04X", WORD(p + sizeof(u16) * i)); > > ^~~~~~~~~~~~~~~~~~~~~~~~~ ./types.h:31:24: note: expanded from macro > > 'WORD' > > #define WORD(x) (u16)(*(const u16 *)(x)) > > ^~~~~~~~~~~~~~~~ > > > > Compilation succeeds, because the x86 platform is tolerant of such > > alignment issues. However, other platforms that need strict alignment > > may not build. (The port is amd64/i386 only on OpenBSD, however).
I have just committed a fix for this: Use unaligned memory accesses unconditionally https://cgit.git.savannah.gnu.org/cgit/dmidecode.git/commit/?id=892a0072e58aea00e5873c3c28965d40c82a9165 -- Jean Delvare SUSE L3 Support
