1 /* Test for a bogus warning on comparison between signed and unsigned.
2 Origin: Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 5/13/2001. */
4 /* { dg-do compile } */
5 /* { dg-options "-fshow-column -Wsign-compare -fstrict-overflow" } */
9 int foo(int x
, int y
, unsigned u
)
11 /* A COMPOUND_EXPR is non-negative if the last element is known to
13 if (u
< (bar(), -1)) /*{ dg-warning "9:different signedness" "COMPOUND_EXPR" }*/
19 if (u
< (x
? (bar(),bar(),bar(),bar(),x
==y
) : 10))
21 if ((x
? 10 : (bar(),bar(),bar(),bar(),x
==y
)) < u
)
24 /* Test an ABS_EXPR, which is by definition non-negative when
25 -fstrict-overflow is used. */
26 if (u
< __builtin_abs(x
))
28 if (__builtin_abs(x
) < u
)
30 if (u
< (x
? __builtin_abs(x
) : 10))
32 if ((x
? 10: __builtin_abs(x
)) < u
)
35 /* A MODIFY_EXPR is non-negative if the new value is known to be
37 if (u
< (x
= -1)) /* { dg-warning "9:different signedness" "MODIFY_EXPR" } */
43 if (u
< (x
= (y
? (x
==y
) : 10)))
45 if ((x
= (y
? 10 : (x
==y
))) < u
)