diff mbox

RFC Asan instrumentation control

Message ID 52CFA617.6000902@partner.samsung.com
State New
Headers show

Commit Message

max Jan. 10, 2014, 7:49 a.m. UTC
Hi!

 >>> * c-c++-common/asan/no-asan-stack.c (this triggers read overflow
 >>> because we haven't found a cross-platform way to grep for stack
 >>> redzones instrumentation)
 >>
 >> I'd prefer no test in that case, or just some semi-platform specific 
test
 >> (scan that the 0x41b58ab3 constant doesn't appear in say some late 
RTL dump,
 >> or perhaps just assembly (just scan it with lower and upper case and 
decimal
 >> too)).
 >
 > Thanks, commited in 206458 without c-c++-common/asan/no-asan-stack.c 
testfile.
 > I'll fix this test according to your recommendations a bit later.

I've fixed the c-c++-common/asan/no-asan-stack.c testfile. Tested on
x86_64-unknown-linux-gnu.

Ok to commit?

-Maxim.

Comments

Jakub Jelinek Jan. 10, 2014, 7:56 a.m. UTC | #1
On Fri, Jan 10, 2014 at 11:49:43AM +0400, Maxim Ostapenko wrote:
> 2014-01-10  Max Ostapenko  <m.ostapenko@partner.samsung.com>
> 
> 	* c-c++-common/asan/no-asan-stack.c: New test.

> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/asan/no-asan-stack.c
> @@ -0,0 +1,17 @@
> +/* { dg-do assemble { target { x86_64-unknown-linux-gnu } } } */
> +/* { dg-options "-save-temps --param asan-stack=0" } */

If you want to limit to x86_64-linux only, please do:
target { { i?86-*-linux* x86_64-*-linux* } && lp64 }
instead.  Also, what advantages do you see for trying to assemble
the result?  If you instead just do dg-do compile, you can drop -save-temps
from dg-options and /* { dg-final { cleanup-saved-temps } } */.

> +#include <string.h>
> +
> +volatile int one = 1;
> +
> +int
> +main ()
> +{
> +  volatile char a1[] = {one, 2, 3, 4};
> +  volatile char a2[] = {1, 2*one, 3, 4};
> +  volatile int res = memcmp ((void *)a1,(void *)a2, 5 + one);
> +  return 0;
> +}
> +
> +/* { dg-final { scan-assembler-not "0x41b58ab3|0x41B58AB3|1102416563" } } */
> +/* { dg-final { cleanup-saved-temps } } */


	Jakub
diff mbox

Patch

2014-01-10  Max Ostapenko  <m.ostapenko@partner.samsung.com>

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

diff --git a/gcc/testsuite/c-c++-common/asan/no-asan-stack.c b/gcc/testsuite/c-c++-common/asan/no-asan-stack.c
new file mode 100644
index 0000000..d81b834
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/no-asan-stack.c
@@ -0,0 +1,17 @@ 
+/* { dg-do assemble { target { x86_64-unknown-linux-gnu } } } */
+/* { dg-options "-save-temps --param asan-stack=0" } */
+#include <string.h>
+
+volatile int one = 1;
+
+int
+main ()
+{
+  volatile char a1[] = {one, 2, 3, 4};
+  volatile char a2[] = {1, 2*one, 3, 4};
+  volatile int res = memcmp ((void *)a1,(void *)a2, 5 + one);
+  return 0;
+}
+
+/* { dg-final { scan-assembler-not "0x41b58ab3|0x41B58AB3|1102416563" } } */
+/* { dg-final { cleanup-saved-temps } } */