[gcc r11-7703] testsuite, Darwin : Fix match output for asan/memcmp-1.c.

Iain D Sandoe iains@gcc.gnu.org
Wed Mar 17 19:13:00 GMT 2021


https://gcc.gnu.org/g:9c4d77fc1cc363342b5963b07e837d2b017cac43

commit r11-7703-g9c4d77fc1cc363342b5963b07e837d2b017cac43
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Wed Mar 17 12:56:49 2021 +0000

    testsuite, Darwin : Fix match output for asan/memcmp-1.c.
    
    The Darwin part of libasan produces different output for memcmp
    cases from other ports.  The GCC implementation does produce the
    same output for this test as the clang one (modulo the two points
    below).
    
    1. To be more compatible with Linux, Darwin testcases that include
    string.h should set _FORTIFY_SOURCE=0 since, otherwise, it will be
    defaulted on and the _chk versions of the string builtins will be
    used.
    
    2. The system tool that handles symbolization (atos) is not reliable
    with GCC's DWARF-2 output but, fortunately, all the platform
    versions that support the current sanitizers are able to handle
    dwarf-3 for this testcase.
    
    gcc/testsuite/ChangeLog:
    
            * c-c++-common/asan/memcmp-1.c: Add _FORTIFY_SOURCE=0 and
            -gdwarf-3 to the command line options.  Provide Darwin-
            specific match lines for the expected output.

Diff:
---
 gcc/testsuite/c-c++-common/asan/memcmp-1.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/c-c++-common/asan/memcmp-1.c b/gcc/testsuite/c-c++-common/asan/memcmp-1.c
index 0403ad78945..0d08c098e0e 100644
--- a/gcc/testsuite/c-c++-common/asan/memcmp-1.c
+++ b/gcc/testsuite/c-c++-common/asan/memcmp-1.c
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-options "-fno-builtin-memcmp" } */
+/* { dg-additional-options "-D_FORTIFY_SOURCE=0 -gdwarf-3" { target *-*-darwin* } } */
 /* { dg-shouldfail "asan" } */
 
 #include <string.h>
@@ -16,5 +17,8 @@ main ()
 }
 
 /* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow.*(\n|\r\n|\r)" } */
-/* { dg-output "    #\[1-9\] 0x\[0-9a-f\]+ +(in _*(interceptor_|wrap_|)memcmp|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "    #\[2-9\] 0x\[0-9a-f\]+ +(in _*main|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "    #\[1-9\] 0x\[0-9a-f\]+ +(in _*(interceptor_|wrap_|)memcmp|\[(\])\[^\n\r]*(\n|\r\n|\r)" { target { ! *-*-darwin* } } } */
+/* { dg-output "    #\[2-9\] 0x\[0-9a-f\]+ +(in _*main|\[(\])\[^\n\r]*(\n|\r\n|\r)" { target { ! *-*-darwin* } } } */
+
+/* { dg-output "    #\[0-9\] 0x\[0-9a-f\]+ +(in MemcmpInterceptorCommon|\[(\])\[^\n\r]*(\n|\r\n|\r)" { target *-*-darwin* } } */
+/* { dg-output "    #\[1-9\] 0x\[0-9a-f\]+ +(in wrap_(memcmp|bcmp)|\[(\])\[^\n\r]*(\n|\r\n|\r)" { target *-*-darwin* } } */


More information about the Gcc-cvs mailing list