re PR sanitizer/80308 (asan crash on big-endian powerpc-linux target)
PR sanitizer/80308 * asan.c (asan_store_shadow_bytes): Fix location of last_chunk_value for big endian. * c-c++-common/asan/pr80308.c: New test. Co-Authored-By: Bernd Edlinger <bernd.edlinger@hotmail.de> From-SVN: r246703
This commit is contained in:
parent
5f5c5e0f07
commit
47a113429b
@ -1,3 +1,10 @@
|
||||
2017-04-05 Jakub Jelinek <jakub@redhat.com>
|
||||
Bernd Edlinger <bernd.edlinger@hotmail.de>
|
||||
|
||||
PR sanitizer/80308
|
||||
* asan.c (asan_store_shadow_bytes): Fix location of last_chunk_value
|
||||
for big endian.
|
||||
|
||||
2017-04-05 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
PR target/78002
|
||||
|
@ -2757,10 +2757,13 @@ asan_store_shadow_bytes (gimple_stmt_iterator *iter, location_t loc,
|
||||
|
||||
unsigned char c = (char) is_clobber ? ASAN_STACK_MAGIC_USE_AFTER_SCOPE : 0;
|
||||
unsigned HOST_WIDE_INT val = 0;
|
||||
unsigned last_pos = size;
|
||||
if (last_chunk_size && !is_clobber)
|
||||
last_pos = BYTES_BIG_ENDIAN ? 0 : size - 1;
|
||||
for (unsigned i = 0; i < size; ++i)
|
||||
{
|
||||
unsigned char shadow_c = c;
|
||||
if (i == size - 1 && last_chunk_size && !is_clobber)
|
||||
if (i == last_pos)
|
||||
shadow_c = last_chunk_size;
|
||||
val |= (unsigned HOST_WIDE_INT) shadow_c << (BITS_PER_UNIT * i);
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
2017-04-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR sanitizer/80308
|
||||
* c-c++-common/asan/pr80308.c: New test.
|
||||
|
||||
2017-04-05 Dominik Vogt <vogt@linux.vnet.ibm.com>
|
||||
|
||||
PR target/79890
|
||||
|
25
gcc/testsuite/c-c++-common/asan/pr80308.c
Normal file
25
gcc/testsuite/c-c++-common/asan/pr80308.c
Normal file
@ -0,0 +1,25 @@
|
||||
/* PR sanitizer/80308 */
|
||||
/* { dg-do run } */
|
||||
|
||||
__attribute__((noinline, noclone)) int
|
||||
foo (char *a)
|
||||
{
|
||||
int i, j = 0;
|
||||
asm volatile ("" : "+r" (a) : : "memory");
|
||||
for (i = 0; i < 12; i++)
|
||||
j += a[i];
|
||||
return j;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int i, j = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
char a[12];
|
||||
__builtin_memset (a, 0, sizeof (a));
|
||||
j += foo (a);
|
||||
}
|
||||
return j;
|
||||
}
|
Loading…
Reference in New Issue
Block a user