1*7c3d14c8STreehugger Robot // RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s 2*7c3d14c8STreehugger Robot // RUN: %clangxx_msan -fsanitize-memory-track-origins -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s 3*7c3d14c8STreehugger Robot // RUN: %clangxx_msan -fsanitize-memory-track-origins -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s 4*7c3d14c8STreehugger Robot 5*7c3d14c8STreehugger Robot // Test condition origin propagation through "select" IR instruction. 6*7c3d14c8STreehugger Robot 7*7c3d14c8STreehugger Robot #include <stdio.h> 8*7c3d14c8STreehugger Robot #include <stdint.h> 9*7c3d14c8STreehugger Robot 10*7c3d14c8STreehugger Robot __attribute__((noinline)) max_by_ptr(int * a,int * b)11*7c3d14c8STreehugger Robotint *max_by_ptr(int *a, int *b) { 12*7c3d14c8STreehugger Robot return *a < *b ? b : a; 13*7c3d14c8STreehugger Robot } 14*7c3d14c8STreehugger Robot main(void)15*7c3d14c8STreehugger Robotint main(void) { 16*7c3d14c8STreehugger Robot int x; 17*7c3d14c8STreehugger Robot int *volatile px = &x; 18*7c3d14c8STreehugger Robot int y = 43; 19*7c3d14c8STreehugger Robot int *p = max_by_ptr(px, &y); 20*7c3d14c8STreehugger Robot // CHECK: Uninitialized value was created by an allocation of 'x' in the stack frame of function 'main' 21*7c3d14c8STreehugger Robot return *p; 22*7c3d14c8STreehugger Robot } 23