OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gcc.dg/] [Wconversion-5.c] - Diff between revs 298 and 384

Only display areas with differences | Details | Blame | View Log

Rev 298 Rev 384
/* PR c++/34198 */
/* PR c++/34198 */
/* { dg-do compile } */
/* { dg-do compile } */
/* { dg-options "-O2 -Wconversion" } */
/* { dg-options "-O2 -Wconversion" } */
 
 
signed char sc;
signed char sc;
unsigned char uc;
unsigned char uc;
short int ss;
short int ss;
unsigned short int us;
unsigned short int us;
int si;
int si;
unsigned int ui;
unsigned int ui;
 
 
void test1 (void)
void test1 (void)
{
{
  int a = uc & 0xff;
  int a = uc & 0xff;
  int b = sc & 0x7f;
  int b = sc & 0x7f;
  int c = 0xff & uc;
  int c = 0xff & uc;
  int d = 0x7f & sc;
  int d = 0x7f & sc;
  int e = uc & sc;
  int e = uc & sc;
  unsigned char f = (int) uc;
  unsigned char f = (int) uc;
  signed char g = (int) sc;
  signed char g = (int) sc;
  unsigned char h = (unsigned int) (short int) uc;
  unsigned char h = (unsigned int) (short int) uc;
  signed char i = (int) (unsigned short int) sc;        /* { dg-warning "may alter its value" "" { target { int32plus } } } */
  signed char i = (int) (unsigned short int) sc;        /* { dg-warning "may alter its value" "" { target { int32plus } } } */
  unsigned char j = (unsigned int) (short int) us;      /* { dg-warning "may alter its value" } */
  unsigned char j = (unsigned int) (short int) us;      /* { dg-warning "may alter its value" } */
  signed char k = (int) (unsigned short int) ss;        /* { dg-warning "may alter its value" } */
  signed char k = (int) (unsigned short int) ss;        /* { dg-warning "may alter its value" } */
}
}
 
 
void test2 (void)
void test2 (void)
{
{
  signed char a = (unsigned char) sc;           /* { dg-warning "may change the sign" } */
  signed char a = (unsigned char) sc;           /* { dg-warning "may change the sign" } */
  unsigned char b = (signed char) uc;           /* { dg-warning "may change the sign" } */
  unsigned char b = (signed char) uc;           /* { dg-warning "may change the sign" } */
  signed char c = (int) (unsigned char) sc;     /* { dg-warning "may change the sign" } */
  signed char c = (int) (unsigned char) sc;     /* { dg-warning "may change the sign" } */
  unsigned char d = (int) (signed char) uc;     /* { dg-warning "may change the sign" } */
  unsigned char d = (int) (signed char) uc;     /* { dg-warning "may change the sign" } */
  int e = (unsigned int) si;                    /* { dg-warning "may change the sign" } */
  int e = (unsigned int) si;                    /* { dg-warning "may change the sign" } */
  unsigned int f = (int) ui;                    /* { dg-warning "may change the sign" } */
  unsigned int f = (int) ui;                    /* { dg-warning "may change the sign" } */
}
}
 
 

powered by: WebSVN 2.1.0

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