+2016-06-13 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/64516
+ * fold-const.c (fold_unary_loc): Preserve alignment when
+ folding a VIEW_CONVERT_EXPR into a MEM_REF.
+
2016-06-13 Martin Liska <mliska@suse.cz>
PR sanitizer/71458
case VIEW_CONVERT_EXPR:
if (TREE_CODE (op0) == MEM_REF)
{
+ if (TYPE_ALIGN (TREE_TYPE (op0)) != TYPE_ALIGN (type))
+ type = build_aligned_type (type, TYPE_ALIGN (TREE_TYPE (op0)));
tem = fold_build2_loc (loc, MEM_REF, type,
TREE_OPERAND (op0, 0), TREE_OPERAND (op0, 1));
REF_REVERSE_STORAGE_ORDER (tem) = REF_REVERSE_STORAGE_ORDER (op0);
+2016-06-13 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/64516
+ * gcc.dg/align-3.c: New testcase.
+
2016-06-13 Martin Liska <mliska@suse.cz>
* gcc.target/i386/pr71458.c: New test.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-rtl-expand" } */
+
+typedef struct { char a[2]; } __attribute__((__packed__)) TU2;
+unsigned short get16_unaligned(const void *p) {
+ unsigned short v;
+ *(TU2 *)(void *)(&v) = *(const TU2 *)p;
+ return v;
+}
+
+/* { dg-final { scan-rtl-dump "MEM\[^\n\r\]*A8\\\]" "expand" } } */