diff options
author | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2019-02-15 21:40:24 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2019-02-15 21:40:24 +0000 |
commit | 362432c00db860483058ff609a893151bf8e4b1c (patch) | |
tree | e19a433d3eed4a55aee8a47c74bcd0cdeac20a4c /gcc/asan.c | |
parent | dd66d9d71d71c2b48c109fdd7908b754b7594677 (diff) | |
download | gcc-362432c00db860483058ff609a893151bf8e4b1c.zip gcc-362432c00db860483058ff609a893151bf8e4b1c.tar.gz gcc-362432c00db860483058ff609a893151bf8e4b1c.tar.bz2 |
asan.c (asan_emit_stack_protection): Use full-sized mask to align the base address on 64-bit strict-alignment platforms.
* asan.c (asan_emit_stack_protection): Use full-sized mask to align
the base address on 64-bit strict-alignment platforms.
From-SVN: r268949
Diffstat (limited to 'gcc/asan.c')
-rw-r--r-- | gcc/asan.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -1440,13 +1440,15 @@ asan_emit_stack_protection (rtx base, rtx pbase, unsigned int alignb, base_align_bias = ((asan_frame_size + alignb - 1) & ~(alignb - HOST_WIDE_INT_1)) - asan_frame_size; } + /* Align base if target is STRICT_ALIGNMENT. */ if (STRICT_ALIGNMENT) - base = expand_binop (Pmode, and_optab, base, - gen_int_mode (-((GET_MODE_ALIGNMENT (SImode) - << ASAN_SHADOW_SHIFT) - / BITS_PER_UNIT), Pmode), NULL_RTX, - 1, OPTAB_DIRECT); + { + const HOST_WIDE_INT align + = (GET_MODE_ALIGNMENT (SImode) / BITS_PER_UNIT) << ASAN_SHADOW_SHIFT; + base = expand_binop (Pmode, and_optab, base, gen_int_mode (-align, Pmode), + NULL_RTX, 1, OPTAB_DIRECT); + } if (use_after_return_class == -1 && pbase) emit_move_insn (pbase, base); |