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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [pr30260.c] - Rev 689

Compare with Previous | Blame | View Log

/* PR 30260  */
/* { dg-do link } */
/* { dg-options "-pedantic -O" } */
#include <limits.h>
 
enum A {
  A1 = 0, 
  A2 = A1 - 1
};
enum B {
  B1 = 0u, 
  B2 = B1 - 1 /* { dg-bogus "ISO C restricts enumerator values to range of 'int'" } */
};
int main(void)
{
  enum A a = -1;
  enum B b = -1;
 
  if (!(a < 0))
    link_error ();
  if (!(A2 < 0))
    link_error ();
  if (!(b < 0))
    link_error ();
  if (!(B2 < 0))
    link_error ();
 
  return 0;
}
 
enum E1 { e10 = INT_MAX, e11 }; /* { dg-error "overflow in enumeration values" } */
enum E2 { e20 = (unsigned) INT_MAX, e21 }; /* { dg-error "overflow in enumeration values" } */
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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