xref: /aosp_15_r20/external/compiler-rt/test/msan/report-demangling.cc (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1*7c3d14c8STreehugger Robot // Test that function name is mangled in the "created by an allocation" line,
2*7c3d14c8STreehugger Robot // and demangled in the single-frame "stack trace" that follows.
3*7c3d14c8STreehugger Robot 
4*7c3d14c8STreehugger Robot // RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1
5*7c3d14c8STreehugger Robot // RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
6*7c3d14c8STreehugger Robot 
7*7c3d14c8STreehugger Robot __attribute__((noinline))
f()8*7c3d14c8STreehugger Robot int f() {
9*7c3d14c8STreehugger Robot   int x;
10*7c3d14c8STreehugger Robot   int *volatile p = &x;
11*7c3d14c8STreehugger Robot   return *p;
12*7c3d14c8STreehugger Robot }
13*7c3d14c8STreehugger Robot 
main(int argc,char ** argv)14*7c3d14c8STreehugger Robot int main(int argc, char **argv) {
15*7c3d14c8STreehugger Robot   return f();
16*7c3d14c8STreehugger Robot   // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
17*7c3d14c8STreehugger Robot   // CHECK: Uninitialized value was created by an allocation of 'x' in the stack frame of function '_Z1fv'
18*7c3d14c8STreehugger Robot   // CHECK: #0 {{.*}} in f{{.*}} {{.*}}report-demangling.cc:[[@LINE-10]]
19*7c3d14c8STreehugger Robot }
20