blob: 633a8b15c4440303b581ceff37a65cfb607aabb6 [file] [log] [blame]
Pirama Arumuga Nainar7c915052015-04-08 08:58:29 -07001// RUN: %clangxx_msan -O0 %s -o %t && %run %t
2// RUN: %clangxx_msan -DPOSITIVE -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -08003// REQUIRES: x86_64-supported-target
Stephen Hines2d1fdb22014-05-28 23:58:16 -07004
5#include <emmintrin.h>
6
7int to_int(double v) {
8 __m128d t = _mm_set_sd(v);
9 int x = _mm_cvtsd_si32(t);
10 return x;
11 // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
Stephen Hines6a211c52014-07-21 00:49:56 -070012 // CHECK: #{{.*}} in to_int{{.*}}vector_cvt.cc:[[@LINE-3]]
Stephen Hines2d1fdb22014-05-28 23:58:16 -070013}
14
15int main() {
16#ifdef POSITIVE
17 double v;
18#else
19 double v = 1.1;
20#endif
21 double* volatile p = &v;
22 int x = to_int(*p);
23 return !x;
24}