brintos

brintos / llvm-project-archived public Read only

0
0
Text · 792 B · 1666a88 Raw
35 lines · cpp
1// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -fsanitize-memory-track-origins=2 -O3 %s -o %t && \2// RUN:     env MSAN_OPTIONS=store_context_size=1 not %run %t 2>&1 | FileCheck %s3 4// Test that stack trace for the intermediate store is not empty.5 6// CHECK: MemorySanitizer: use-of-uninitialized-value7// CHECK:   #0 {{.*}} in main8 9// CHECK: Uninitialized value was stored to memory at10// CHECK:   #0 {{.*}} in fn_g11// CHECK-NOT: #112 13// CHECK: Uninitialized value was created by an allocation of 'z' in the stack frame14// CHECK:   #0 {{.*}} in main15 16#include <stdio.h>17 18volatile int x;19 20__attribute__((noinline))21void fn_g(int a) {22  x = a;23}24 25__attribute__((noinline))26void fn_f(int a) {27  fn_g(a);28}29 30int main(int argc, char *argv[]) {31  int volatile z;32  fn_f(z);33  return x;34}35