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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [abi/] [regparm1.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// PR c++/29911 (9381)
2
// { dg-options -std=c++0x }
3
// { dg-do run { target i?86-*-* x86_64-*-* } }
4
 
5
extern "C" int printf(const char *, ...);
6
 
7
void *save_this;
8
int *save_addr1, *save_addr2;
9
 
10
int fail;
11
 
12
struct Base
13
{
14
  __attribute((regparm(3))) void
15
  set(int *addr1, int *addr2)
16
  {
17
    if (this != save_this)
18
      {
19
        ++fail;
20
        printf("error! this == %p, should be %p\n", this, save_this);
21
      }
22
    if (addr1 != save_addr1)
23
      {
24
        ++fail;
25
        printf("error! addr1 == %p, should be %p\n", addr1, save_addr1);
26
      }
27
    if (addr2 != save_addr2)
28
      {
29
        ++fail;
30
        printf("error! addr2 == %p, should be %p\n", addr2, save_addr1);
31
      }
32
  }
33
};
34
 
35
int main()
36
{
37
  void (__attribute((regparm(3))) Base::* pfm)(int *, int *) = &Base::set;
38
  __typeof (&Base::set) pfm2 = &Base::set;
39
  decltype (&Base::set) pfm3 = &Base::set;
40
  auto pfm4 = &Base::set;
41
 
42
  Base obj; save_this = &obj;
43
  int x, y; save_addr1 = &x; save_addr2 = &y;
44
 
45
  (obj.* pfm) (&x, &y);
46
  (obj.* pfm2) (&x, &y);
47
  (obj.* pfm3) (&x, &y);
48
  (obj.* pfm4) (&x, &y);
49
 
50
  return fail;
51
}

powered by: WebSVN 2.1.0

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