From: Eric Biggers Date: Sun, 16 Jul 2017 06:26:33 +0000 (-0700) Subject: unaligned: use may_alias attribute X-Git-Tag: v1.12.0~6 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=e1e717054ca1ba93bfcafbe5f0ec7de7483c1853 unaligned: use may_alias attribute gcc7 miscompiles the "undo" mode of translate_if_needed() in lzms_common.c because the get_unaligned_le16() was incorrectly being moved before the put_unaligned_le32(). Fix it by marking the special "unaligned" structs with the may_alias attribute. --- diff --git a/include/wimlib/unaligned.h b/include/wimlib/unaligned.h index ead46295..473f5e25 100644 --- a/include/wimlib/unaligned.h +++ b/include/wimlib/unaligned.h @@ -28,7 +28,7 @@ #define DEFINE_UNALIGNED_TYPE(type) \ struct type##_unaligned { \ type v; \ -} _packed_attribute; \ +} _packed_attribute _may_alias_attribute; \ \ static forceinline type \ load_##type##_unaligned(const void *p) \