diff mbox

[Commited] Fix PR sanitizer/63638

Message ID CAJOtW+57XGXg8c2VgMKQng8tdtiNox0Xp-x57UvYzV7v63Sgbw@mail.gmail.com
State New
Headers show

Commit Message

Yuri Gribov Oct. 24, 2014, 8:19 p.m. UTC
Hi all,

This patch fixes was approved by Jakub in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63638 . Same fix for 5.0
will be probably commited in
https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02066.html .

-Y
commit 87a472b057af66d46a5437137e9535c70de5c786
Author: Yury Gribov <y.gribov@samsung.com>
Date:   Fri Oct 24 19:20:37 2014 +0400

    2014-10-24  Yury Gribov  <y.gribov@samsung.com>
    
    gcc/
    	* asan.c (enum asan_check_flags): Fixed ASAN_CHECK_LAST.
    
    gcc/testsuite/
    	* c-c++-common/asan/pr63638.c: New test.

Comments

Yuri Gribov Oct. 24, 2014, 8:22 p.m. UTC | #1
On Sat, Oct 25, 2014 at 12:19 AM, Yuri Gribov <tetra2005@gmail.com> wrote:
> Same fix for 5.0 will be probably commited in

Forgot to mention that this one is for 4.9.

-Y
diff mbox

Patch

diff --git a/gcc/asan.c b/gcc/asan.c
index 7c27fe7..f6c42a1 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -250,7 +250,7 @@  enum asan_check_flags
   ASAN_CHECK_NON_ZERO_LEN = 1 << 2,
   ASAN_CHECK_START_INSTRUMENTED = 1 << 3,
   ASAN_CHECK_END_INSTRUMENTED = 1 << 4,
-  ASAN_CHECK_LAST
+  ASAN_CHECK_LAST = 1 << 5
 };
 
 /* Hashtable support for memory references used by gimple
diff --git a/gcc/testsuite/c-c++-common/asan/pr63638.c b/gcc/testsuite/c-c++-common/asan/pr63638.c
new file mode 100644
index 0000000..a8bafc5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr63638.c
@@ -0,0 +1,20 @@ 
+/* { dg-do compile } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void *memcpy (void *, const void *, __SIZE_TYPE__);
+
+struct S{
+  long d0, d1, d2, d3, d4, d5, d6;
+};
+
+struct S s[6];
+
+int f(struct S *p)
+{
+  memcpy(p, &s[2], sizeof(*p));
+  memcpy(p, &s[1], sizeof(*p));
+}
+