Commit 9e463823 by Jakub Jelinek Committed by Jakub Jelinek

re PR sanitizer/79944 (asan: incorrect instrumentation of atomic operations)

	PR sanitizer/79944
	* asan.c (get_mem_refs_of_builtin_call): For BUILT_IN_ATOMIC* and
	BUILT_IN_SYNC*, determine the access type from the size suffix and
	always build a MEM_REF with that type.  Handle forgotten
	BUILT_IN_SYNC_FETCH_AND_NAND_16 and BUILT_IN_SYNC_NAND_AND_FETCH_16.

	* c-c++-common/asan/pr79944.c: New test.

From-SVN: r245991
parent 6b62f323
2017-03-09 Jakub Jelinek <jakub@redhat.com> 2017-03-09 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/79944
* asan.c (get_mem_refs_of_builtin_call): For BUILT_IN_ATOMIC* and
BUILT_IN_SYNC*, determine the access type from the size suffix and
always build a MEM_REF with that type. Handle forgotten
BUILT_IN_SYNC_FETCH_AND_NAND_16 and BUILT_IN_SYNC_NAND_AND_FETCH_16.
PR target/79932 PR target/79932
* config/i386/avx512vlintrin.h (_mm256_cmpge_epi32_mask, * config/i386/avx512vlintrin.h (_mm256_cmpge_epi32_mask,
_mm256_cmpge_epi64_mask, _mm256_cmpge_epu32_mask, _mm256_cmpge_epi64_mask, _mm256_cmpge_epu32_mask,
......
2017-03-09 Jakub Jelinek <jakub@redhat.com> 2017-03-09 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/79944
* c-c++-common/asan/pr79944.c: New test.
PR target/79932 PR target/79932
* gcc.target/i386/pr79932-2.c: New test. * gcc.target/i386/pr79932-2.c: New test.
......
/* PR sanitizer/79944 */
/* { dg-do run } */
struct S { int i; char p[1024]; };
int
main ()
{
struct S *p = (struct S *) __builtin_malloc (__builtin_offsetof (struct S, p) + 64);
p->i = 5;
asm volatile ("" : "+r" (p) : : "memory");
__atomic_fetch_add ((int *) p, 5, __ATOMIC_RELAXED);
asm volatile ("" : "+r" (p) : : "memory");
if (p->i != 10)
__builtin_abort ();
__builtin_free (p);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment