summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/objc.dg/torture/tls/thr-init-3.m
blob: 6ac977c9bae66b492af941ea58104f8808c52ded (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* { dg-do run } */
/* { dg-require-effective-target tls } */
/* { dg-add-options tls } */
/* { dg-skip-if "PR44140" { *-*-* } { "-flto" "-fwhopr" } { "" } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
/* { dg-additional-sources "../../../objc-obj-c++-shared/Object1.m" } */

#include "../../../objc-obj-c++-shared/Object1.h"
extern void _exit(int);

@interface tsObj: Object {
  int ai ;
}

- (int) fa:(int) n;

@end

@implementation tsObj

- (int) fa:(int) n
{
static __thread int as = 3;
  as += n ;
  return as ;
}

@end

int main (int ac, char *av[])
{
  int a ;
  tsObj *to = [tsObj new];
  
  a = [to fa:5];
  if ( a != 8 ) 
    _exit (-(__LINE__)) ;
  
  return 0;
}
OpenPOWER on IntegriCloud