OSDN Git Service

2005-02-03 Andrew Pinski <pinskia@physics.uc.edu>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / opt / inline9.C
1 // PR c++/17972
2 // Origin: Michal Ostrowski <mostrows@watson.ibm.com>
3 // Testcase by Alan Modra <amodra@bigpond.net.au>
4 // { dg-do run }
5 // { dg-options "-O" }
6 // { dg-options "-O -mtune=i686" { target i?86-*-* } }
7
8 struct thread_info
9 {
10   short preempt_count;
11 } x;
12
13 static inline struct thread_info *cti (void) __attribute__ ((const));
14 static inline struct thread_info *cti (void)
15 {
16   return &x;
17 }
18
19 void fn (void) __attribute__ ((noinline));
20 void fn (void)
21 {
22   ++cti()->preempt_count;
23 }
24
25 int main (void)
26 {
27   fn ();
28   return 0;
29 }