Building UPower from branch `master` with Clang 3.4, the following two warnings are generated. $ git describe UPOWER_0_99_0-1-ge96f534 $ clang --version Debian clang version 3.4-1 (trunk) (based on LLVM 3.4) Target: i386-pc-linux-gnu Thread model: posix $ $ CC=clang ./autogen.sh […] config.status: executing po/stamp-it commands UPower 0.99.1 ========================= prefix: /usr/local libdir: ${exec_prefix}/lib libexecdir: ${exec_prefix}/libexec bindir: ${exec_prefix}/bin sbindir: ${exec_prefix}/sbin datadir: ${datarootdir} sysconfdir: ${prefix}/etc localstatedir: ${prefix}/var docdir: ${datarootdir}/doc/${PACKAGE_TARNAME} compiler: clang cflags: -g -O2 cppflags: -DG_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE -DGSEAL_ENABLE xsltproc: /usr/bin/xsltproc Enable deprecated stuff: no Backend: linux libimobiledevice support: yes Maintainer mode: yes Building api docs: no Building man pages: yes Building unit tests: yes $ make […] CC libupshared_la-hidpp-device.lo hidpp-device.c:837:13: warning: cast from 'guchar *' (aka 'unsigned char *') to 'guint32 *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Wcast-align] serialp = (guint32 *) &msg.l.params[1]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. CC libupshared_la-sysfs-utils.lo CC libupshared_la-up-device-idevice.lo CCLD libupshared.la CC hidpp_test-hidpp-device.o hidpp-device.c:837:13: warning: cast from 'guchar *' (aka 'unsigned char *') to 'guint32 *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Wcast-align] serialp = (guint32 *) &msg.l.params[1]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. […]
Created attachment 109651 [details] [review] hidpp-device: avoid unaligned memory access This warning popped up here too, the attached patch fixes it.
commit b3e5143f5a56beee63529fd25b44522ae282e226 Author: Peter Wu <peter@lekensteyn.nl> Date: Mon Nov 17 22:33:32 2014 +0100 hidpp-device: avoid unaligned memory access Fixes a -Wcast-align warning and a -fsanitize=undefined error. https://bugs.freedesktop.org/show_bug.cgi?id=71079
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.