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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-dev/] [fsf-gcc-snapshot-1-mar-12/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [warn/] [Wconversion-pr34389.C] - Blame information for rev 783

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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