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 "-Wsign-compare" } */
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 "signed and unsigned" "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. */
25 if (u < __builtin_abs(x))
27 if (__builtin_abs(x) < u)
29 if (u < (x ? __builtin_abs(x) : 10))
31 if ((x ? 10: __builtin_abs(x)) < u)
34 /* A MODIFY_EXPR is non-negative if the new value is known to be
36 if (u < (x = -1)) /* { dg-warning "signed and unsigned" "MODIFY_EXPR" } */
42 if (u < (x = (y ? (x==y) : 10)))
44 if ((x = (y ? 10 : (x==y))) < u)