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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [special/] [initp1.C] - Blame information for rev 149

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* This doesn't work on solaris2 for reasons described in PR 6482.  */
2
/* { dg-do run { xfail *-*-solaris2* } } */
3
#include 
4
 
5
class Two {
6
private:
7
    int i, j, k;
8
public:
9
    static int count;
10
    Two( int ii, int jj ) { i = ii; j = jj; k = count++; };
11
    Two( void )           { i =  0; j =  0; k = count++; };
12
    int eye( void ) { return i; };
13
    int jay( void ) { return j; };
14
    int kay( void ) { return k; };
15
};
16
 
17
extern Two foo;
18
extern Two goo;
19
extern Two coo[];
20
extern Two koo[];
21
 
22
Two foo __attribute__((init_priority(1005))) ( 5, 6 );
23
 
24
Two goo __attribute__((init_priority(1007))) = Two( 7, 8 );
25
 
26
Two doo[ 3 ];
27
 
28
Two hoo[ 3 ] = {
29
    Two( 11, 12 ),
30
    Two( 13, 14 ),
31
    Two( 15, 16 )
32
};
33
 
34
Two coo[ 3 ] __attribute__((init_priority(1000)));
35
 
36
Two koo[ 3 ] __attribute__((init_priority(1000))) = {
37
    Two( 21, 22 ),
38
    Two( 23, 24 ),
39
    Two( 25, 26 )
40
};
41
 
42
Two xoo[ 3 ] __attribute__((init_priority(1100)));
43
 
44
Two zoo[ 3 ] __attribute__((init_priority(1100))) = {
45
    Two( 31, 32 ),
46
    Two( 33, 34 ),
47
    Two( 35, 36 )
48
};
49
 
50
int Two::count;
51
 
52
long x = 0;
53
 
54
#define X( n ) \
55
  do { if ( x & (1L << (n)) ) return 1; else x |= (1L << (n)); } while (0)
56
 
57
int main()
58
{
59
 
60
    X( coo[0].kay() );
61
    X( coo[1].kay() );
62
    X( coo[2].kay() );
63
    X( koo[0].kay() );
64
    X( koo[1].kay() );
65
    X( koo[2].kay() );
66
    if ( 0x3f != x ) abort ();
67
 
68
    X( foo.kay() );
69
    if ( 0x7f != x ) abort ();
70
 
71
    X( goo.kay() );
72
    if ( 0xff != x ) abort ();
73
 
74
    X( xoo[0].kay() );
75
    X( xoo[1].kay() );
76
    X( xoo[2].kay() );
77
    X( zoo[0].kay() );
78
    X( zoo[1].kay() );
79
    X( zoo[2].kay() );
80
    if ( 0x3fff != x ) abort ();
81
 
82
    X( doo[0].kay() );
83
    X( doo[1].kay() );
84
    X( doo[2].kay() );
85
    X( hoo[0].kay() );
86
    X( hoo[1].kay() );
87
    X( hoo[2].kay() );
88
    if ( 0xfffff != x ) abort ();
89
 
90
    exit (0);
91
}

powered by: WebSVN 2.1.0

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