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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* PR 30260  */
2
/* { dg-do link } */
3
/* { dg-options "-pedantic -O" } */
4
#include <limits.h>
5
 
6
enum A {
7
  A1 = 0,
8
  A2 = A1 - 1
9
};
10
enum B {
11
  B1 = 0u,
12
  B2 = B1 - 1 /* { dg-bogus "ISO C restricts enumerator values to range of 'int'" } */
13
};
14
int main(void)
15
{
16
  enum A a = -1;
17
  enum B b = -1;
18
 
19
  if (!(a < 0))
20
    link_error ();
21
  if (!(A2 < 0))
22
    link_error ();
23
  if (!(b < 0))
24
    link_error ();
25
  if (!(B2 < 0))
26
    link_error ();
27
 
28
  return 0;
29
}
30
 
31
enum E1 { e10 = INT_MAX, e11 }; /* { dg-error "overflow in enumeration values" } */
32
enum E2 { e20 = (unsigned) INT_MAX, e21 }; /* { dg-error "overflow in enumeration values" } */

powered by: WebSVN 2.1.0

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