26 lines · cpp
1// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O0 %s -o %t && %run %t >%t.out 2>&12// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O1 %s -o %t && %run %t >%t.out 2>&13// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O2 %s -o %t && %run %t >%t.out 2>&14// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O3 %s -o %t && %run %t >%t.out 2>&15 6// Test that (no_sanitize_memory) functions DO NOT propagate shadow.7 8#include <stdlib.h>9#include <stdio.h>10 11__attribute__((noinline))12__attribute__((weak))13__attribute__((no_sanitize_memory))14int f(int x) {15 return x;16}17 18int main(void) {19 int x;20 int * volatile p = &x;21 int y = f(*p);22 if (y)23 exit(0);24 return 0;25}26