diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2019-02-12 12:23:08 +0000 |
---|---|---|
committer | Dongkyun Son <dongkyun.s@samsung.com> | 2019-07-22 21:17:44 +0900 |
commit | 9c821914467fa884a0b3b57fe2fa93a5dc71136b (patch) | |
tree | 35fe43834c1cd36fc9319f18ebbee51d85b9ac91 | |
parent | 73efd936dfa88bcabb3434623b0e5bf361951d08 (diff) | |
download | linaro-gcc-9c821914467fa884a0b3b57fe2fa93a5dc71136b.tar.gz linaro-gcc-9c821914467fa884a0b3b57fe2fa93a5dc71136b.tar.bz2 linaro-gcc-9c821914467fa884a0b3b57fe2fa93a5dc71136b.zip |
* asan.c (asan_expand_mark_ifn): Take into account the alignment of
the object to pick the size of stores on strict-alignment platforms.
* config/sparc/sparc.md (*movsi_insn): Minor tweak.
(*movdi_insn_sp32): Likewise.
(*movdi_insn_sp64): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268792 138bc75d-0d04-0410-961f-82ee72b054a4
(backported 3f00a89f9cdb0f2838ce0d853ef3bf6ff6f5a3ad without config/sparc fixes)
Change-Id: Id53952131b13fe5eba6b6de1f6d40531833d19fd
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/asan.c | 11 |
2 files changed, 17 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6c74cb2f30f..ffa65a3abef 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-02-12 Eric Botcazou <ebotcazou@adacore.com> + + * asan.c (asan_expand_mark_ifn): Take into account the alignment of + the object to pick the size of stores on strict-alignment platforms. + + * config/sparc/sparc.md (*movsi_insn): Minor tweak. + (*movdi_insn_sp32): Likewise. + (*movdi_insn_sp64): Likewise. + 2018-12-05 Jakub Jelinek <jakub@redhat.com> PR sanitizer/88333 diff --git a/gcc/asan.c b/gcc/asan.c index 813e97bb78b..b32dbc950b7 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -2881,7 +2881,10 @@ asan_expand_mark_ifn (gimple_stmt_iterator *iter) /* Generate direct emission if size_in_bytes is small. */ if (size_in_bytes <= ASAN_PARAM_USE_AFTER_SCOPE_DIRECT_EMISSION_THRESHOLD) { - unsigned HOST_WIDE_INT shadow_size = shadow_mem_size (size_in_bytes); + const unsigned HOST_WIDE_INT shadow_size + = shadow_mem_size (size_in_bytes); + const unsigned int shadow_align + = (get_pointer_alignment (base) / BITS_PER_UNIT) >> ASAN_SHADOW_SHIFT; tree shadow = build_shadow_mem_access (iter, loc, base_addr, shadow_ptr_types[0], true); @@ -2889,9 +2892,11 @@ asan_expand_mark_ifn (gimple_stmt_iterator *iter) for (unsigned HOST_WIDE_INT offset = 0; offset < shadow_size;) { unsigned size = 1; - if (shadow_size - offset >= 4) + if (shadow_size - offset >= 4 + && (!STRICT_ALIGNMENT || shadow_align >= 4)) size = 4; - else if (shadow_size - offset >= 2) + else if (shadow_size - offset >= 2 + && (!STRICT_ALIGNMENT || shadow_align >= 2)) size = 2; unsigned HOST_WIDE_INT last_chunk_size = 0; |