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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [Wconversion-5.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* PR c++/34198 */
2
/* { dg-do compile } */
3
/* { dg-options "-O2 -Wconversion" } */
4
 
5
signed char sc;
6
unsigned char uc;
7
short int ss;
8
unsigned short int us;
9
int si;
10
unsigned int ui;
11
 
12
void test1 (void)
13
{
14
  int a = uc & 0xff;
15
  int b = sc & 0x7f;
16
  int c = 0xff & uc;
17
  int d = 0x7f & sc;
18
  int e = uc & sc;
19
  unsigned char f = (int) uc;
20
  signed char g = (int) sc;
21
  unsigned char h = (unsigned int) (short int) uc;
22
  signed char i = (int) (unsigned short int) sc;        /* { dg-warning "may alter its value" "" { target { int32plus } } } */
23
  unsigned char j = (unsigned int) (short int) us;      /* { dg-warning "may alter its value" } */
24
  signed char k = (int) (unsigned short int) ss;        /* { dg-warning "may alter its value" } */
25
}
26
 
27
void test2 (void)
28
{
29
  signed char a = (unsigned char) sc;           /* { dg-warning "may change the sign" } */
30
  unsigned char b = (signed char) uc;           /* { dg-warning "may change the sign" } */
31
  signed char c = (int) (unsigned char) sc;     /* { dg-warning "may change the sign" } */
32
  unsigned char d = (int) (signed char) uc;     /* { dg-warning "may change the sign" } */
33
  int e = (unsigned int) si;                    /* { dg-warning "may change the sign" } */
34
  unsigned int f = (int) ui;                    /* { dg-warning "may change the sign" } */
35
}

powered by: WebSVN 2.1.0

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