diff options
author | Richard Biener <rguenther@suse.de> | 2016-06-13 07:34:45 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-06-13 07:34:45 +0000 |
commit | f57f53d3a5a0b18fdf5cef76247aed5f4b1e5610 (patch) | |
tree | 67f378aa91a113aa2504bf2746b17d80db874e88 /gcc/fold-const.c | |
parent | f423253bd71fe25fc97e9aef002e33dd1619f0d4 (diff) | |
download | gcc-f57f53d3a5a0b18fdf5cef76247aed5f4b1e5610.zip gcc-f57f53d3a5a0b18fdf5cef76247aed5f4b1e5610.tar.gz gcc-f57f53d3a5a0b18fdf5cef76247aed5f4b1e5610.tar.bz2 |
re PR middle-end/64516 (arm: wrong unaligned load generated)
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.
* gcc.dg/align-3.c: New testcase.
From-SVN: r237355
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 7f8803c..1a464ec 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -7975,6 +7975,8 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0) 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); |