diff mbox

[rs6000] pr65479 Add option to fix failing asan test cases.

Message ID 39413c1c-a91f-3038-df8f-96ca142f2eb9@linux.vnet.ibm.com
State New
Headers show

Commit Message

Bill Seurer Oct. 14, 2016, 7:37 p.m. UTC
[PATCH, rs6000] pr65479 Add option to fix failing asan test cases.

This patch adds the -fasynchronous-unwind-tables option to several of the asan
test cases.  The option causes a full strack trace to be produced when the
sanitizer detects an error.  Without the full trace the 3 test cases fail.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65479 for more information.

Bootstrapped and tested on powerpc64le-unknown-linux-gnu,
powerpc64be-unknown-linux-gnu, and x86_64-pc-linux-gnu with no regressions.
Is this ok for trunk?

[gcc/testsuite]

2016-10-14  Bill Seurer  <seurer@linux.vnet.ibm.com>

c-c++-common/asan/misalign-1.c: Add option for powerpc.
c-c++-common/asan/misalign-2.c: Add option for powerpc.
c-c++-common/asan/null-deref-1.c: Add option for powerpc.

Comments

Segher Boessenkool Oct. 14, 2016, 9:59 p.m. UTC | #1
On Fri, Oct 14, 2016 at 02:37:42PM -0500, Bill Seurer wrote:
> [PATCH, rs6000] pr65479 Add option to fix failing asan test cases.
> 
> This patch adds the -fasynchronous-unwind-tables option to several of the asan
> test cases.  The option causes a full strack trace to be produced when the
> sanitizer detects an error.  Without the full trace the 3 test cases fail.

Should we enable this whenever asan is used, instead?  Not just in the
testsuite?  And is this actually PowerPC-specific?


Segher
Bill Seurer Oct. 17, 2016, 3:24 p.m. UTC | #2
On 10/14/2016 04:59 PM, Segher Boessenkool wrote:
> On Fri, Oct 14, 2016 at 02:37:42PM -0500, Bill Seurer wrote:
>> [PATCH, rs6000] pr65479 Add option to fix failing asan test cases.
>>
>> This patch adds the -fasynchronous-unwind-tables option to several of the asan
>> test cases.  The option causes a full strack trace to be produced when the
>> sanitizer detects an error.  Without the full trace the 3 test cases fail.
>
> Should we enable this whenever asan is used, instead?  Not just in the
> testsuite?  And is this actually PowerPC-specific?

It is needed on these tests because of how they check the traceback 
stack looking for specific functions.  Without the option only the first 
(triggering) function is included.

I don't know if the option is power specific but on x86 for instance the 
traceback gives all the functions without the option.
diff mbox

Patch

Index: gcc/testsuite/c-c++-common/asan/misalign-1.c
===================================================================
--- gcc/testsuite/c-c++-common/asan/misalign-1.c	(revision 241174)
+++ gcc/testsuite/c-c++-common/asan/misalign-1.c	(working copy)
@@ -1,6 +1,7 @@ 
 /* { dg-do run { target { ilp32 || lp64 } } } */
 /* { dg-options "-O2" } */
 /* { dg-additional-options "-fno-omit-frame-pointer" { target *-*-darwin* } } */
+/* { dg-additional-options "-fasynchronous-unwind-tables" { target { powerpc*-*-linux* } } } */
 /* { dg-shouldfail "asan" } */
 
 struct S { int i; } __attribute__ ((packed));
@@ -39,5 +40,5 @@  main ()
 /* { dg-output "ERROR: AddressSanitizer:\[^\n\r]*on address\[^\n\r]*" } */
 /* { dg-output "0x\[0-9a-f\]+ at pc 0x\[0-9a-f\]+ bp 0x\[0-9a-f\]+ sp 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */
 /* { dg-output "\[^\n\r]*READ of size 4 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "    #0 0x\[0-9a-f\]+ +(in _*foo(\[^\n\r]*misalign-1.c:1\[01]|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "    #1 0x\[0-9a-f\]+ +(in _*main (\[^\n\r]*misalign-1.c:3\[45]|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
+/* { dg-output "    #0 0x\[0-9a-f\]+ +(in _*foo(\[^\n\r]*misalign-1.c:1\[12]|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "    #1 0x\[0-9a-f\]+ +(in _*main (\[^\n\r]*misalign-1.c:3\[56]|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
Index: gcc/testsuite/c-c++-common/asan/misalign-2.c
===================================================================
--- gcc/testsuite/c-c++-common/asan/misalign-2.c	(revision 241174)
+++ gcc/testsuite/c-c++-common/asan/misalign-2.c	(working copy)
@@ -1,6 +1,7 @@ 
 /* { dg-do run { target { ilp32 || lp64 } } } */
 /* { dg-options "-O2" } */
 /* { dg-additional-options "-fno-omit-frame-pointer" { target *-*-darwin* } } */
+/* { dg-additional-options "-fasynchronous-unwind-tables" { target { powerpc*-*-linux* } } } */
 /* { dg-shouldfail "asan" } */
 
 struct S { int i; } __attribute__ ((packed));
@@ -39,5 +40,5 @@  main ()
 /* { dg-output "ERROR: AddressSanitizer:\[^\n\r]*on address\[^\n\r]*" } */
 /* { dg-output "0x\[0-9a-f\]+ at pc 0x\[0-9a-f\]+ bp 0x\[0-9a-f\]+ sp 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */
 /* { dg-output "\[^\n\r]*READ of size 4 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "    #0 0x\[0-9a-f\]+ +(in _*baz(\[^\n\r]*misalign-2.c:2\[23]|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "    #1 0x\[0-9a-f\]+ +(in _*main (\[^\n\r]*misalign-2.c:3\[45]|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
+/* { dg-output "    #0 0x\[0-9a-f\]+ +(in _*baz(\[^\n\r]*misalign-2.c:2\[34]|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "    #1 0x\[0-9a-f\]+ +(in _*main (\[^\n\r]*misalign-2.c:3\[56]|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
Index: gcc/testsuite/c-c++-common/asan/null-deref-1.c
===================================================================
--- gcc/testsuite/c-c++-common/asan/null-deref-1.c	(revision 241174)
+++ gcc/testsuite/c-c++-common/asan/null-deref-1.c	(working copy)
@@ -1,6 +1,7 @@ 
 /* { dg-do run } */
 /* { dg-options "-fno-omit-frame-pointer -fno-shrink-wrap" } */
 /* { dg-additional-options "-mno-omit-leaf-frame-pointer" { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-additional-options "-fasynchronous-unwind-tables" { target { powerpc*-*-linux* } } } */
 /* { dg-shouldfail "asan" } */
 
 __attribute__((noinline, noclone))
@@ -18,5 +19,5 @@  int main()
 
 /* { dg-output "ERROR: AddressSanitizer:? SEGV on unknown address\[^\n\r]*" } */
 /* { dg-output "0x\[0-9a-f\]+ \[^\n\r]*pc 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*    #0 0x\[0-9a-f\]+ +(in \[^\n\r]*NullDeref\[^\n\r]* (\[^\n\r]*null-deref-1.c:10|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "    #1 0x\[0-9a-f\]+ +(in _*main (\[^\n\r]*null-deref-1.c:15|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*    #0 0x\[0-9a-f\]+ +(in \[^\n\r]*NullDeref\[^\n\r]* (\[^\n\r]*null-deref-1.c:11|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "    #1 0x\[0-9a-f\]+ +(in _*main (\[^\n\r]*null-deref-1.c:16|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */