public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][PING] Fix for PR 61422
@ 2014-06-16  6:51 Marat Zakirov
  2014-06-18  5:46 ` Yury Gribov
  0 siblings, 1 reply; 2+ messages in thread
From: Marat Zakirov @ 2014-06-16  6:51 UTC (permalink / raw)
  To: gcc-patches
  Cc: 'Konstantin Serebryany', 'Jakub Jelinek',
	'Slava Garbuzov', Gribov Yury, 'Marat Zakirov'

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]



-----Original Message-----
From: Marat Zakirov [mailto:m.zakirov@samsung.com] 
Sent: Friday, June 06, 2014 3:43 PM
To: 'gcc-patches@gcc.gnu.org'
Cc: 'Konstantin Serebryany'; 'Jakub Jelinek'; 'Slava Garbuzov'; Gribov Yury;
'Marat Zakirov'
Subject: [PATCH] Fix for PR 61422

Hi all,

Here's a patch for PR 61422
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61422). 

It fixes false positive on 16 byte access in ffmpeg standard library opus
file NLSF_del_dec_quant.c.  

Reg. tested on x64.

--Marat

[-- Attachment #2: PR61422.diff --]
[-- Type: application/octet-stream, Size: 1974 bytes --]

gcc/ChangeLog:

2014-06-06  Marat Zakirov  <m.zakirov@samsung.com>

	PR sanitizer/61422
	* asan.c (build_check_stmt): Fixed check for unaligned accesses.

gcc/testsuite/ChangeLog:

2014-06-06  Marat Zakirov  <m.zakirov@samsung.org>

	PR sanitizer/61422
	* c-c++-common/asan/data-align.c: New test.


diff --git a/gcc/asan.c b/gcc/asan.c
index 5021338..73bffdc 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -1517,8 +1517,6 @@ build_check_stmt (location_t location, tree base, gimple_stmt_iterator *iter,
   basic_block then_bb, else_bb;
   tree t, base_addr, shadow;
   gimple g;
-  tree shadow_ptr_type = shadow_ptr_types[size_in_bytes == 16 ? 1 : 0];
-  tree shadow_type = TREE_TYPE (shadow_ptr_type);
   tree uintptr_type
     = build_nonstandard_integer_type (TYPE_PRECISION (TREE_TYPE (base)), 1);
   tree base_ssa = base;
@@ -1535,6 +1533,9 @@ build_check_stmt (location_t location, tree base, gimple_stmt_iterator *iter,
       slow_p = true;
     }
 
+  tree shadow_ptr_type = shadow_ptr_types[real_size_in_bytes == 16 ? 1 : 0];
+  tree shadow_type = TREE_TYPE (shadow_ptr_type);
+
   /* Get an iterator on the point where we can add the condition
      statement for the instrumentation.  */
   gsi = create_cond_insert_point (iter, before_p,
diff --git a/gcc/testsuite/c-c++-common/asan/data-align.c b/gcc/testsuite/c-c++-common/asan/data-align.c
new file mode 100644
index 0000000..f99f9f2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/data-align.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+
+struct S { char c[16]; } __attribute__((packed));
+
+__attribute__((noinline, noclone)) struct S
+foo (struct S *p)
+{
+  asm volatile ("" : : "r" (p) : "memory");
+  return *p;
+}
+
+int
+main ()
+{
+  struct S a __attribute__((aligned (16)));
+  struct S b __attribute__((aligned (16)));
+  __builtin_memset (&b, 0, sizeof b);
+  a = foo (&b);
+  asm volatile ("" : : "m" (a), "m" (b));
+  return 0;
+}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][PING] Fix for PR 61422
  2014-06-16  6:51 [PATCH][PING] Fix for PR 61422 Marat Zakirov
@ 2014-06-18  5:46 ` Yury Gribov
  0 siblings, 0 replies; 2+ messages in thread
From: Yury Gribov @ 2014-06-18  5:46 UTC (permalink / raw)
  To: Marat Zakirov, gcc-patches
  Cc: 'Konstantin Serebryany', 'Jakub Jelinek',
	'Slava Garbuzov', 'Marat Zakirov'

Have already been done in r211699. Does it work for you? Adding a test 
would still be useful.

-Y

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-18  5:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-16  6:51 [PATCH][PING] Fix for PR 61422 Marat Zakirov
2014-06-18  5:46 ` Yury Gribov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).