brintos

brintos / llvm-project-archived public Read only

0
0
Text · 823 B · 730b18c Raw
25 lines · cpp
1// Regression test for origin propagation in "select i1, float, float".2// https://code.google.com/p/memory-sanitizer/issues/detail?id=783 4// RUN: %clangxx_msan -O2 -fsanitize-memory-track-origins %s -o %t && not %run %t >%t.out 2>&15// RUN: FileCheck %s < %t.out6 7// RUN: %clangxx_msan -O2 -fsanitize-memory-track-origins=2 %s -o %t && not %run %t >%t.out 2>&18// RUN: FileCheck %s < %t.out9 10#include <stdio.h>11#include <sanitizer/msan_interface.h>12 13int main() {14  volatile bool b = true;15  float x, y;16  __msan_allocated_memory(&x, sizeof(x));17  __msan_allocated_memory(&y, sizeof(y));18  float z = b ? x : y;19  if (z > 0) printf(".\n");20  // CHECK: Memory was marked as uninitialized21  // CHECK: {{#0 0x.* in .*__msan_allocated_memory}}22  // CHECK: {{#1 0x.* in main .*select_float_origin.cpp:}}[[@LINE-6]]23  return 0;24}25