1 /// Same as global-location.cpp, but without debuginfo. In a separate file to
2 /// allow this test to also run on Windows (which can't be done for the
3 /// debuginfo variant).
5 // RUN: %clangxx_asan -O2 %S/global-location.cpp -o %t %if target={{.*-windows-msvc.*}} %{ -Wl,/DEBUG:NONE %} %else %{ -Wl,-S %} %if target={{.*-solaris.*}} %{ -fuse-ld= %}
6 // RUN: not %run %t g 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=GLOB-NO-G
7 // RUN: not %run %t c 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CLASS_STATIC-NO-G
8 // RUN: not %run %t f 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=FUNC_STATIC-NO-G
9 // RUN: not %run %t l 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=LITERAL-NO-G
11 /// Solaris ld -S has different semantics, so enforce -fuse-ld= for
12 /// configurations that default to GNU ld.
13 // XFAIL: target={{.*solaris.*}}
15 // CHECK: AddressSanitizer: global-buffer-overflow
16 // CLASS_STATIC-NO-G: 0x{{.*}} is located 4 bytes after global variable '{{.*}}C::array{{.*}}' defined in '{{.*}}global-location.cpp' {{.*}} of size 40
17 // GLOB-NO-G: 0x{{.*}} is located 4 bytes after global variable '{{.*}}global{{.*}}' defined in '{{.*}}global-location.cpp' {{.*}} of size 40
18 // FUNC_STATIC-NO-G: 0x{{.*}} is located 4 bytes after global variable '{{.*}}main{{.*}}::array{{.*}}' defined in '{{.*}}global-location.cpp' {{.*}} of size 40
19 // LITERAL-NO-G: 0x{{.*}} is located 0 bytes after global variable {{.*}} defined in '{{.*}}global-location.cpp' {{.*}} of size 11
20 // CHECK: SUMMARY: AddressSanitizer: global-buffer-overflow