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-pr34389.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* PR 34389 */
2
/* { dg-do compile } */
3
/* { dg-options "-Wconversion -Wsign-conversion" } */
4
/* { dg-require-effective-target int32plus } */
5
 
6
short  mask1(short x)
7
{
8
  short y = 0x7fff;
9
  return x & y;
10
}
11
 
12
short  mask2(short ssx)
13
{
14
  short ssy;
15
  short ssz;
16
 
17
  ssz = ((int)ssx) & 0x7fff;
18
  ssy = ((int)ssx) | 0x7fff;
19
  ssz = ((int)ssx) ^ 0x7fff;
20
  return ssx & 0x7fff;
21
}
22
 
23
short  mask3(int si, unsigned int ui)
24
{
25
  short ss;
26
  unsigned short us;
27
 
28
  ss = si & 0x7fff;
29
  ss = si & 0xAAAA; /* { dg-warning "conversion" } */
30
  ss = ui & 0x7fff;
31
  ss = ui & 0xAAAA; /* { dg-warning "conversion" } */
32
 
33
  us = si & 0x7fff;
34
  us = si & 0xAAAA; /* { dg-warning "conversion" } */
35
  us = ui & 0x7fff;
36
  us = ui & 0xAAAA; /* 0xAAAA is zero-extended, thus it masks the
37
                       upper bits of 'ui' making it fit in 'us'.  */
38
 
39
  return ss;
40
}
41
 
42
short  mask4(int x, int y)
43
{
44
  return x & y; /* { dg-warning "conversion" } */
45
}
46
 
47
short  mask5(int x)
48
{
49
  return x & -1; /* { dg-warning "conversion" } */
50
}
51
 
52
short  mask6(short x)
53
{
54
  return x & -1;
55
}

powered by: WebSVN 2.1.0

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