Debian Codegraph @

gcc/testsuite/g++.dg/opt/inline9.C

raw
1 // PR c++/17972
2 // Origin: Michal Ostrowski <[email protected]>
3 // Testcase by Alan Modra <[email protected]>
4 // { dg-do run }
5 // { dg-options "-O" }
6 // { dg-options "-O -mtune=i686" { target { { i?86-*-* x86_64-*-* } && ia32 } } }
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 }