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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20020614-1.c] - Rev 154

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

/* PR c/6677 */
/* Verify that GCC doesn't perform illegal simplifications
   when folding constants.  */
 
#include <limits.h>
 
extern void abort (void);
extern void exit (int);
 
int main (void)
{
  int i;
  signed char j;
  unsigned char k;
 
  i = SCHAR_MAX;
 
  j = ((signed char) (i << 1)) / 2;
 
  if (j != -1)
    abort();
 
  j = ((signed char) (i * 2)) / 2;
 
  if (j != -1)
    abort();
 
  i = UCHAR_MAX;
 
  k = ((unsigned char) (i << 1)) / 2;
 
  if (k != UCHAR_MAX/2)
    abort();
 
  k = ((unsigned char) (i * 2)) / 2;
 
  if (k != UCHAR_MAX/2)
    abort();
 
  exit(0);
}
 

Go to most recent revision | 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.