OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [compare3.c] - Blame information for rev 867

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
   This was inspired by code in gcc. */
3
 
4
/* { dg-do compile } */
5
/* { dg-options "-Wsign-compare" } */
6
 
7
int tf = 1;
8
 
9
void f(int x, unsigned int y)
10
{
11
  /* Test comparing conditional expressions containing truth values.
12
     This can occur explicitly, or e.g. when (foo?2:(bar?1:0)) is
13
     optimized into (foo?2:(bar!=0)).  */
14
  x > (tf?64:(tf!=x)); /* { dg-bogus "signed and unsigned" "case 1" } */
15
  y > (tf?64:(tf!=x)); /* { dg-bogus "signed and unsigned" "case 2" } */
16
  x > (tf?(tf!=x):64); /* { dg-bogus "signed and unsigned" "case 3" } */
17
  y > (tf?(tf!=x):64); /* { dg-bogus "signed and unsigned" "case 4" } */
18
 
19
  x > (tf?64:(tf==x)); /* { dg-bogus "signed and unsigned" "case 5" } */
20
  y > (tf?64:(tf==x)); /* { dg-bogus "signed and unsigned" "case 6" } */
21
  x > (tf?(tf==x):64); /* { dg-bogus "signed and unsigned" "case 7" } */
22
  y > (tf?(tf==x):64); /* { dg-bogus "signed and unsigned" "case 8" } */
23
 
24
  x > (tf?64:(tf>x)); /* { dg-bogus "signed and unsigned" "case 9" } */
25
  y > (tf?64:(tf>x)); /* { dg-bogus "signed and unsigned" "case 10" } */
26
  x > (tf?(tf>x):64); /* { dg-bogus "signed and unsigned" "case 11" } */
27
  y > (tf?(tf>x):64); /* { dg-bogus "signed and unsigned" "case 12" } */
28
 
29
  x < (tf?64:(tf<x)); /* { dg-bogus "signed and unsigned" "case 13" } */
30
  y < (tf?64:(tf<x)); /* { dg-bogus "signed and unsigned" "case 14" } */
31
  x < (tf?(tf<x):64); /* { dg-bogus "signed and unsigned" "case 15" } */
32
  y < (tf?(tf<x):64); /* { dg-bogus "signed and unsigned" "case 16" } */
33
 
34
  x > (tf?64:(tf>=x)); /* { dg-bogus "signed and unsigned" "case 17" } */
35
  y > (tf?64:(tf>=x)); /* { dg-bogus "signed and unsigned" "case 18" } */
36
  x > (tf?(tf>=x):64); /* { dg-bogus "signed and unsigned" "case 19" } */
37
  y > (tf?(tf>=x):64); /* { dg-bogus "signed and unsigned" "case 20" } */
38
 
39
  x > (tf?64:(tf<=x)); /* { dg-bogus "signed and unsigned" "case 21" } */
40
  y > (tf?64:(tf<=x)); /* { dg-bogus "signed and unsigned" "case 22" } */
41
  x > (tf?(tf<=x):64); /* { dg-bogus "signed and unsigned" "case 23" } */
42
  y > (tf?(tf<=x):64); /* { dg-bogus "signed and unsigned" "case 24" } */
43
 
44
  x > (tf?64:(tf&&x)); /* { dg-bogus "signed and unsigned" "case 25" } */
45
  y > (tf?64:(tf&&x)); /* { dg-bogus "signed and unsigned" "case 26" } */
46
  x > (tf?(tf&&x):64); /* { dg-bogus "signed and unsigned" "case 27" } */
47
  y > (tf?(tf&&x):64); /* { dg-bogus "signed and unsigned" "case 28" } */
48
 
49
  x > (tf?64:(tf||x)); /* { dg-bogus "signed and unsigned" "case 29" } */
50
  y > (tf?64:(tf||x)); /* { dg-bogus "signed and unsigned" "case 30" } */
51
  x > (tf?(tf||x):64); /* { dg-bogus "signed and unsigned" "case 31" } */
52
  y > (tf?(tf||x):64); /* { dg-bogus "signed and unsigned" "case 32" } */
53
 
54
  x > (tf?64:(!tf)); /* { dg-bogus "signed and unsigned" "case 33" } */
55
  y > (tf?64:(!tf)); /* { dg-bogus "signed and unsigned" "case 34" } */
56
  x > (tf?(!tf):64); /* { dg-bogus "signed and unsigned" "case 35" } */
57
  y > (tf?(!tf):64); /* { dg-bogus "signed and unsigned" "case 36" } */
58
 
59
}

powered by: WebSVN 2.1.0

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