Re: [PATCH] optionally disable global check

2015-03-11 Thread Jakub Jelinek
On Fri, Mar 06, 2015 at 05:23:47PM +0300, Marat Zakirov wrote:
 Hi all!
 
 Currently !ASAN_GLOBALS disables red-zones for global variables but keeps
 their checks. This simple patch disables these checks too.

I've noticed
UNRESOLVED: c-c++-common/asan/no-asan-check-glob.c   -O0   scan-tree-dump-times 
asan1 ASAN_CHECK 0
UNRESOLVED: c-c++-common/asan/no-asan-check-glob.c   -O2 -flto 
-fuse-linker-plugin -fno-fat-lto-objects   scan-tree-dump-times asan1 
ASAN_CHECK 0
in my last build, fixed thusly, committed as obvious:

2015-03-11  Jakub Jelinek  ja...@redhat.com

* c-c++-common/asan/no-asan-check-glob.c: Add -ffat-lto-objects
to dg-options, fix up dg-skip-if.

--- gcc/testsuite/c-c++-common/asan/no-asan-check-glob.c.jj 2015-03-11 
20:17:46.0 +0100
+++ gcc/testsuite/c-c++-common/asan/no-asan-check-glob.c2015-03-11 
20:47:22.010109724 +0100
@@ -1,6 +1,6 @@
-/* { dg-options --param asan-globals=0 -fdump-tree-asan } */
+/* { dg-options --param asan-globals=0 -fdump-tree-asan1 -ffat-lto-objects } 
*/
 /* { dg-do compile } */
-/* { dg-skip-if  { *-*-* } { -O0 } { * } } */
+/* { dg-skip-if  { *-*-* } { -O0 } {  } } */
 
 extern int a;
 

Jakub


Re: [PATCH] optionally disable global check

2015-03-09 Thread Jakub Jelinek
On Fri, Mar 06, 2015 at 06:41:38PM +0300, Yury Gribov wrote:
 On 03/06/2015 05:23 PM, Marat Zakirov wrote:
 Hi all!
 
 Currently !ASAN_GLOBALS disables red-zones for global variables but
 keeps their checks. This simple patch disables these checks too.
 
 --Marat
 
 Jakub,
 
 Given that this may be considered a bugfix for --param asan-globals, perhaps
 this is ok for 5.0?
 
 
  2015-01-22  Marat Zakirov  m.zaki...@samsung.com
 
 I think you'll want to update dates here.
 
  * asan.c (instrument_derefs): asan-globals=0 disable instrumentation.
 
 s/asan-globals=0 disable instrumentation/Disable instrumentation on
 asan-globals=0./g

Ok with those changes.

Jakub


[PATCH] optionally disable global check

2015-03-06 Thread Marat Zakirov

Hi all!

Currently !ASAN_GLOBALS disables red-zones for global variables but 
keeps their checks. This simple patch disables these checks too.


--Marat
gcc/ChangeLog:

2015-01-22  Marat Zakirov  m.zaki...@samsung.com

	* asan.c (instrument_derefs): asan-globals=0 disable instrumentation.

gcc/testsuite/ChangeLog:

2015-01-22  Marat Zakirov  m.zaki...@samsung.com

	* c-c++-common/asan/no-asan-check-glob.c: New test.


diff --git a/gcc/asan.c b/gcc/asan.c
index be28ede..c331f67 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -1809,6 +1809,8 @@ instrument_derefs (gimple_stmt_iterator *iter, tree t,
 {
   if (DECL_THREAD_LOCAL_P (inner))
 	return;
+  if (!ASAN_GLOBALS  is_global_var (inner))
+return;
   if (!TREE_STATIC (inner))
 	{
 	  /* Automatic vars in the current function will be always
diff --git a/gcc/testsuite/c-c++-common/asan/no-asan-check-glob.c b/gcc/testsuite/c-c++-common/asan/no-asan-check-glob.c
new file mode 100644
index 000..a1b1410
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/no-asan-check-glob.c
@@ -0,0 +1,13 @@
+/* { dg-options --param asan-globals=0 -fdump-tree-asan } */
+/* { dg-do compile } */
+/* { dg-skip-if  { *-*-* } { -O0 } { * } } */
+
+extern int a;
+
+int foo ()
+{
+  return a;
+}
+
+/* { dg-final { scan-tree-dump-times ASAN_CHECK 0 asan1 } } */
+/* { dg-final { cleanup-tree-dump asan1 } } */


Re: [PATCH] optionally disable global check

2015-03-06 Thread Yury Gribov

On 03/06/2015 05:23 PM, Marat Zakirov wrote:

Hi all!

Currently !ASAN_GLOBALS disables red-zones for global variables but
keeps their checks. This simple patch disables these checks too.

--Marat


Jakub,

Given that this may be considered a bugfix for --param asan-globals, 
perhaps this is ok for 5.0?



 2015-01-22  Marat Zakirov  m.zaki...@samsung.com

I think you'll want to update dates here.

* asan.c (instrument_derefs): asan-globals=0 disable instrumentation.

s/asan-globals=0 disable instrumentation/Disable instrumentation on 
asan-globals=0./g


-Y