1  /* { dg-do run } */
       2  /* { dg-require-effective-target tls } */
       3  /* { dg-require-effective-target global_constructor } */
       4  /* { dg-options "-O2" } */
       5  /* { dg-require-effective-target tls_runtime } */
       6  /* { dg-add-options tls } */
       7  
       8  __thread int i __attribute__((common));
       9  
      10  extern void abort (void);
      11  
      12  int test_code(int b)
      13  {
      14    i += b ;
      15    return i;
      16  }
      17  
      18  int main (int ac, char *av[])
      19  {
      20    int a = test_code(test_code(1));
      21    
      22    if ((a != 2) || (i != 2))
      23      abort () ;
      24    
      25    return 0;
      26  }