111
|
1 // tests that the asm directive is correctly handled for static fields
|
|
2 // in structures and classes. This only applies to C++; such
|
|
3 // directives generate errors in C. Assembler directives for local
|
|
4 // variables should be tested by the C test suite.
|
|
5 //
|
|
6 // Contributed by Robert Bowdidge (bowdidge@apple.com) 14 Oct 2003
|
|
7
|
|
8 // { dg-do compile }
|
|
9
|
|
10 struct Foo {
|
|
11 // This should reference a variable called bar
|
|
12 static int i __asm__("bar");
|
|
13 };
|
|
14
|
|
15
|
|
16 class Bar {
|
|
17 public:
|
|
18 static int i __asm__("theRealI");
|
|
19 static int j __asm__("theRealJ");
|
|
20 int boof;
|
|
21 };
|
|
22
|
|
23 class Baz : public Bar {
|
|
24 public:
|
|
25 static char *ptr __asm__ ("theRealString");
|
|
26 };
|
|
27
|
|
28 int main (int argc, char **argv) {
|
|
29 struct Foo myFoo;
|
|
30 Bar b;
|
|
31 myFoo.i = 1;
|
|
32 Foo::i = 2;
|
|
33 Baz::j = 10;
|
|
34 Baz::ptr = 0;
|
|
35 b.i = 1;
|
|
36 return (b.i);
|
|
37 }
|
|
38
|
|
39
|
|
40 /* { dg-final {scan-assembler "bar"} } */
|
|
41 /* { dg-final {scan-assembler "theRealString"} } */
|
|
42 /* { dg-final {scan-assembler "theRealI" } } */
|
|
43 /* { dg-final {scan-assembler "theRealJ" } } */
|