OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [compare5.c] - Blame information for rev 645

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Test for a bogus warning on comparison between signed and unsigned.
2
   Origin: Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/21/2001.  */
3
 
4
/* { dg-do compile } */
5
/* { dg-options "-Wsign-compare" } */
6
 
7
extern void bar(void);
8
 
9
int foo(int x, int y, unsigned u)
10
{
11
  /* A *_DIV_EXPR is non-negative if both operands are.  */
12
 
13
  if (u < ((x=-22)/33)) /* { dg-warning "signed and unsigned" "DIV_EXPR" } */
14
    return x;
15
 
16
  if (u < ((x=22)/33))
17
    return x;
18
 
19
  if (u < ((x=22)/(y=33)))
20
    return x;
21
 
22
  if (u < (((x&0x10000)?128:64) / ((y&0x10000)?8:4)))
23
    return x;
24
 
25
 
26
  /* A *_MOD_EXPR is non-negative if the first operand is.  */
27
 
28
  if (u < ((x=-22)%33)) /* { dg-warning "signed and unsigned" "MOD_EXPR" } */
29
    return x;
30
 
31
  if (u < ((x=22)%-33))
32
    return x;
33
 
34
  if (u < ((x==y)%-33))
35
    return x;
36
 
37
  if (u < (((x=22)/33)%-33))
38
    return x;
39
 
40
  return 0;
41
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.