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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [compare2.c] - Blame information for rev 328

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

Line No. Rev Author Line
1 298 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
  /* ?: branches are constants.  */
12
  x > (tf?64:128); /* { dg-bogus "signed and unsigned" "case 1" } */
13
  y > (tf?64:128); /* { dg-bogus "signed and unsigned" "case 2" } */
14
 
15
  /* ?: branches are (recursively) constants.  */
16
  x > (tf?64:(tf?128:256)); /* { dg-bogus "signed and unsigned" "case 3" } */
17
  y > (tf?64:(tf?128:256)); /* { dg-bogus "signed and unsigned" "case 4" } */
18
 
19
  /* ?: branches are signed constants.  */
20
  x > (tf?64:-1); /* { dg-bogus "signed and unsigned" "case 5" } */
21
  y > (tf?64:-1); /* { dg-warning "signed and unsigned" "case 6" } */
22
 
23
  /* ?: branches are (recursively) signed constants.  */
24
  x > (tf?64:(tf?128:-1)); /* { dg-bogus "signed and unsigned" "case 7" } */
25
  y > (tf?64:(tf?128:-1)); /* { dg-warning "signed and unsigned" "case 8" } */
26
 
27
  /* Statement expression.  */
28
  x > ({tf; 64;}); /* { dg-bogus "signed and unsigned" "case 9" } */
29
  y > ({tf; 64;}); /* { dg-bogus "signed and unsigned" "case 10" } */
30
 
31
  /* Statement expression with recursive ?: .  */
32
  x > ({tf; tf?64:(tf?128:256);}); /* { dg-bogus "signed and unsigned" "case 11" } */
33
  y > ({tf; tf?64:(tf?128:256);}); /* { dg-bogus "signed and unsigned" "case 12" } */
34
 
35
  /* Statement expression with signed ?:.  */
36
  x > ({tf; tf?64:-1;}); /* { dg-bogus "signed and unsigned" "case 13" } */
37
  y > ({tf; tf?64:-1;}); /* { dg-warning "signed and unsigned" "case 14" } */
38
 
39
  /* Statement expression with recursive signed ?:.  */
40
  x > ({tf; tf?64:(tf?128:-1);}); /* { dg-bogus "signed and unsigned" "case 15" } */
41
  y > ({tf; tf?64:(tf?128:-1);}); /* { dg-warning "signed and unsigned" "case 16" } */
42
 
43
  /* ?: branches are constants.  */
44
  tf ? x : (tf?64:32); /* { dg-bogus "conditional expression" "case 17" } */
45
  tf ? y : (tf?64:32); /* { dg-bogus "conditional expression" "case 18" } */
46
 
47
  /* ?: branches are signed constants.  */
48
  tf ? x : (tf?64:-1); /* { dg-bogus "conditional expression" "case 19" } */
49
  tf ? y : (tf?64:-1); /* { dg-warning "conditional expression" "case 20" } */
50
 
51
  /* ?: branches are (recursively) constants.  */
52
  tf ? x : (tf?64:(tf?128:256)); /* { dg-bogus "conditional expression" "case 21" } */
53
  tf ? y : (tf?64:(tf?128:256)); /* { dg-bogus "conditional expression" "case 22" } */
54
 
55
  /* ?: branches are (recursively) signed constants.  */
56
  tf ? x : (tf?64:(tf?128:-1)); /* { dg-bogus "conditional expression" "case 23" } */
57
  tf ? y : (tf?64:(tf?128:-1)); /* { dg-warning "conditional expression" "case 24" } */
58
}

powered by: WebSVN 2.1.0

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