| 1 | // RUN: %clang_cc1 %s -verify -Wconversion -fsyntax-only -triple x86_64-pc-linux-gnu |
| 2 | // RUN: %clang_cc1 %s -verify -Wconversion -fsyntax-only -triple i386-pc-linux-gnu |
| 3 | |
| 4 | void test(void) { |
| 5 | unsigned int a = 1; |
| 6 | |
| 7 | unsigned long long b = -a; // expected-warning {{higher order bits are zeroes after implicit conversion}} |
| 8 | long long c = -a; // expected-warning {{the resulting value is always non-negative after implicit conversion}} |
| 9 | |
| 10 | unsigned long b2 = -a; |
| 11 | #ifdef __x86_64__ |
| 12 | // expected-warning@-2 {{higher order bits are zeroes after implicit conversion}} |
| 13 | #endif |
| 14 | long c2 = -a; |
| 15 | #ifdef __x86_64__ |
| 16 | // expected-warning@-2 {{the resulting value is always non-negative after implicit conversion}} |
| 17 | #else |
| 18 | // expected-warning@-4 {{implicit conversion changes signedness: 'unsigned int' to 'long'}} |
| 19 | #endif |
| 20 | } |
| 21 | |