From e1e717054ca1ba93bfcafbe5f0ec7de7483c1853 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 15 Jul 2017 23:26:33 -0700 Subject: [PATCH] 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. --- include/wimlib/unaligned.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) \ -- 2.43.0