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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [compare9.c] - Blame information for rev 774

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

Line No. Rev Author Line
1 689 jeremybenn
/* Test for a bogus warning on comparison between signed and unsigned.
2
   This was inspired by code in gcc.  This testcase is identical to
3
   compare1.c except that we use -fshort-enums here and do not expect
4
   a warning from case 4.  */
5
 
6
/* { dg-do compile } */
7
/* { dg-options "-fshort-enums -Wsign-compare" } */
8
 
9
int tf = 1;
10
 
11
/* This enumeration has an explicit negative value and is therefore signed.  */
12
enum mm1
13
{
14
  VOID, SI, DI, MAX = -1
15
};
16
 
17
/* This enumeration fits entirely in a signed int, but is unsigned anyway.  */
18
enum mm2
19
{
20
  VOID2, SI2, DI2, MAX2
21
};
22
 
23
int f(enum mm1 x)
24
{
25
  return x == (tf?DI:SI); /* { dg-bogus "signed and unsigned" "case 1" } */
26
}
27
 
28
int g(enum mm1 x)
29
{
30
  return x == (tf?DI:-1); /* { dg-bogus "signed and unsigned" "case 2" } */
31
}
32
 
33
int h(enum mm2 x)
34
{
35
  return x == (tf?DI2:SI2); /* { dg-bogus "signed and unsigned" "case 3" } */
36
}
37
 
38
int i(enum mm2 x)
39
{
40
  return x == (tf?DI2:-1); /* { dg-bogus "signed and unsigned" "case 4" } */
41
}

powered by: WebSVN 2.1.0

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