conversion-64-32.c revision fdba18263ffd624846701ad115d35edb3e2ee0a7
1// RUN: %clang_cc1 -fsyntax-only -verify -Wshorten-64-to-32 -triple x86_64-apple-darwin %s 2 3int test0(long v) { 4 return v; // expected-warning {{implicit conversion loses integer precision}} 5} 6 7 8// rdar://9546171 9typedef int int4 __attribute__ ((vector_size(16))); 10typedef long long long2 __attribute__((__vector_size__(16))); 11 12int4 test1(long2 a) { 13 int4 v127 = a; // no warning. 14 return v127; 15} 16 17// <rdar://problem/10759934> 18// Don't warn about -Wshorten-64-to-32 in unreachable code. 19typedef unsigned int uint32_t; 20typedef unsigned long long uint64_t; 21int rdar10759934() { 22 uint32_t thing = 0; 23 uint64_t thing2 = 0; 24 25 switch (sizeof(thing2)) { 26 case 8: 27 break; 28 case 4: 29 thing = thing2; // no-warning 30 default: 31 break; 32 } 33 34 return 0; 35} 36