Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / c-c++-common / Wsign-compare-2.c
blob71a7c9899fbb7c4784822a94c97c2b02025b14e4
1 /* { dg-do compile { target { ilp32 || lp64 } } } */
2 /* { dg-options "-Wsign-compare" } */
4 int
5 f1 (unsigned char x)
7 return (unsigned short) (~(unsigned short) x) == 0; /* { dg-warning "promoted bitwise complement of an unsigned value is always nonzero" "" { target c } } */
10 int
11 f2 (unsigned char x)
13 return (unsigned short) (~(unsigned short) x) == 5; /* { dg-warning "comparison of promoted bitwise complement of an unsigned value with constant" "" { target c } } */
16 int
17 f3 (unsigned char x)
19 return (unsigned int) (~(unsigned short) x) == 0xffff0005U; /* { dg-warning "comparison of promoted bitwise complement of an unsigned value with constant" } */
22 int
23 f4 (unsigned char x)
25 return (unsigned int) (~(unsigned short) x) == 0xffff0005ULL; /* { dg-warning "comparison of promoted bitwise complement of an unsigned value with constant" } */
28 int
29 f5 (unsigned char x)
31 return (unsigned int) (~(unsigned short) x) == 0xffffff05U; /* { dg-bogus "comparison of promoted bitwise complement of an unsigned value with constant" } */
34 int
35 f6 (unsigned char x)
37 return (unsigned int) (~(unsigned short) x) == 0xffffff05ULL; /* { dg-bogus "comparison of promoted bitwise complement of an unsigned value with constant" } */
40 int
41 f7 (unsigned char x)
43 return (unsigned long long) (~(unsigned short) x) == 0xffffffffffffff05ULL; /* { dg-bogus "comparison of promoted bitwise complement of an unsigned value with constant" } */
46 typedef unsigned short T;
48 int
49 f8 (T x)
51 return (unsigned short) (~(unsigned short) x) == 0; /* { dg-bogus "promoted bitwise complement of an unsigned value is always nonzero" } */
54 int
55 f9 (T x)
57 return (unsigned short) (~(unsigned short) x) == 5; /* { dg-bogus "comparison of promoted bitwise complement of an unsigned value with constant" } */
60 int
61 f10 (T x, unsigned char y)
63 return (unsigned short) (~(unsigned short) x) == y; /* { dg-bogus "comparison of promoted bitwise complement of an unsigned value with unsigned" } */
66 int
67 f11 (T x, unsigned char y)
69 return (unsigned short) (~(unsigned short) x) == y; /* { dg-bogus "comparison of promoted bitwise complement of an unsigned value with unsigned" } */
72 int
73 f12 (unsigned char x, unsigned char y)
75 return (unsigned short) (~(unsigned short) x) == y; /* { dg-warning "comparison of promoted bitwise complement of an unsigned value with unsigned" "" { target c } } */
78 int
79 f13 (unsigned char x, unsigned char y)
81 return (unsigned short) (~(unsigned short) x) == y; /* { dg-warning "comparison of promoted bitwise complement of an unsigned value with unsigned" "" { target c } } */
84 int
85 f14 (unsigned char x, unsigned int y)
87 return (unsigned long long) (~x) == y; /* { dg-warning "comparison of promoted bitwise complement of an unsigned value with unsigned" } */
90 int
91 f15 (unsigned short x, unsigned int y)
93 return (long long) (~x) == y; /* { dg-warning "comparison of promoted bitwise complement of an unsigned value with unsigned" } */
96 int
97 f16 (unsigned char x, unsigned short y)
99 return (unsigned short) (~(unsigned short) x) == y; /* { dg-bogus "comparison of promoted bitwise complement of an unsigned value with unsigned" } */
103 f17 (unsigned char x, unsigned short y)
105 return (unsigned short) (~(unsigned short) x) == y; /* { dg-bogus "comparison of promoted bitwise complement of an unsigned value with unsigned" } */
109 f18 (unsigned char x)
111 return (unsigned int) (short) (~(unsigned short) x) == 0xffffff05ULL; /* { dg-bogus "comparison of promoted bitwise complement of an unsigned value with constant" } */