summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/gomp/pr32177.C
blob: 55c8483be274e265bb2cbb14fa996190be6b257a (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
41
42
43
44
45
46
// PR c++/32177
// { dg-do compile }
// { dg-options "-fopenmp" }
//
// Copyright (C) 2007 Free Software Foundation, Inc.
// Contributed by Theodore.Papadopoulo 1 Jun 2007 <Theodore.Papadopoulo@sophia.inria.fr>

struct A
{
  A () {}
  ~A () {}
  int s () const { return 1; }
};

void
f1 ()
{
  #pragma omp parallel for
    for (int i = 1; i <= A ().s (); ++i)
      ;
}

void
f2 ()
{
  #pragma omp parallel for
    for (int i = A ().s (); i <= 20; ++i)
      ;
}

void
f3 ()
{
  #pragma omp parallel for
    for (int i = 1; i <= 20; i += A ().s ())
      ;
}

void
f4 ()
{
  int i;
  #pragma omp parallel for
    for (i = A ().s (); i <= 20; i++)
      ;
}