1// { dg-do assemble } 2// { dg-options "-ansi -pedantic-errors -Wsign-compare -Wno-deprecated" } 3 4// Copyright (C) 2001 Free Software Foundation, Inc. 5// Contributed by Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 5/13/2001 6 7int foo(int x, int y, unsigned u) 8{ 9 /* A MAX_EXPR is non-negative if EITHER argument to the MAX_EXPR is 10 determined to be non-negative. */ 11 if (u < (x >? -1)) // { dg-warning "" } signed and unsigned 12 return x; 13 if (u < (x >? 10)) 14 return x; 15 if ((10 >? x) < u) 16 return x; 17 if (u < (x >? (y ? (x==y) : 10))) 18 return x; 19 if (((y ? 10 : (x==y)) >? x) < u) 20 return x; 21 22 /* A MIN_EXPR is non-negative if BOTH arguments to the MIN_EXPR are 23 determined to be non-negative. */ 24 if (u < ((x?11:8) <? -1)) // { dg-warning "" } signed and unsigned 25 return x; 26 if (u < ((x?11:8) <? 10)) 27 return x; 28 if ((10 <? (x?8:11)) < u) 29 return x; 30 if (u < ((x?11:(x==y)) <? 10)) 31 return x; 32 if ((10 <? (x?(x==y):11)) < u) 33 return x; 34 35 return 0; 36} 37