gcc/gcc48-asan-fix.patch

32 lines
781 B
Diff

2013-02-12 Dodji Seketeli <dodji@redhat.com>
* asan.c (instrument_builtin_call): Really put the length of the
second source argument into src1_len.
* c-c++-common/asan/memcmp-2.c: New test.
--- gcc/asan.c
+++ gcc/asan.c
@@ -1764,7 +1764,7 @@ instrument_builtin_call (gimple_stmt_iterator *iter)
if (get_mem_refs_of_builtin_call (call,
&src0, &src0_len, &src0_is_store,
- &src1, &src0_len, &src1_is_store,
+ &src1, &src1_len, &src1_is_store,
&dest, &dest_len, &dest_is_store,
&dest_is_deref))
{
--- gcc/testsuite/c-c++-common/asan/memcmp-2.c
+++ gcc/testsuite/c-c++-common/asan/memcmp-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+
+int
+foo ()
+{
+ char s0[5] = {0};
+ char s1[5] = {1};
+
+ return __builtin_memcmp (s0, s1, 2);
+}