summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/lit_tests/TestCases/global-demangle.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/asan/lit_tests/TestCases/global-demangle.cc')
-rw-r--r--compiler-rt/lib/asan/lit_tests/TestCases/global-demangle.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/lit_tests/TestCases/global-demangle.cc b/compiler-rt/lib/asan/lit_tests/TestCases/global-demangle.cc
new file mode 100644
index 00000000000..5696a38a770
--- /dev/null
+++ b/compiler-rt/lib/asan/lit_tests/TestCases/global-demangle.cc
@@ -0,0 +1,18 @@
+// Don't run through %symbolize to avoid c++filt demangling.
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | FileCheck %s
+
+namespace XXX {
+class YYY {
+ public:
+ static char ZZZ[];
+};
+char YYY::ZZZ[] = "abc";
+}
+
+int main(int argc, char **argv) {
+ return (int)XXX::YYY::ZZZ[argc + 5]; // BOOM
+ // CHECK: {{READ of size 1 at 0x.*}}
+ // CHECK: {{0x.* is located 2 bytes to the right of global variable}}
+ // CHECK: 'XXX::YYY::ZZZ' {{.*}} of size 4
+ // CHECK: 'XXX::YYY::ZZZ' is ascii string 'abc'
+}
OpenPOWER on IntegriCloud