Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/gcc.dg/compare5.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
/* Test for a bogus warning on comparison between signed and unsigned. Origin: Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/21/2001. */ /* { dg-do compile } */ /* { dg-options "-Wsign-compare" } */ extern void bar(void); int foo(int x, int y, unsigned u) { /* A *_DIV_EXPR is non-negative if both operands are. */ if (u < ((x=-22)/33)) /* { dg-warning "different signedness" "DIV_EXPR" } */ return x; if (u < ((x=22)/33)) return x; if (u < ((x=22)/(y=33))) return x; if (u < (((x&0x10000)?128:64) / ((y&0x10000)?8:4))) return x; /* A *_MOD_EXPR is non-negative if the first operand is. */ if (u < ((x=-22)%33)) /* { dg-warning "different signedness" "MOD_EXPR" } */ return x; if (u < ((x=22)%-33)) return x; if (u < ((x==y)%-33)) return x; if (u < (((x=22)/33)%-33)) return x; return 0; }