gcc/libgomp/testsuite/libgomp.c++/for-7.C

111 lines
1.3 KiB
C++
Raw Normal View History

// PR c++/
// { dg-do run }
Run testsuite/libgomp.c++/c++.exp at -O2 by default 2015-06-30 Tom de Vries <tom@codesourcery.com> * testsuite/libgomp.c++/c++.exp: Set DEFAULT_CFLAGS to -O2 if not already set. Use DEFAULT_CFLAGS in dg-runtest. * testsuite/libgomp.c++/atomic-16.C: Remove dg-options "-O2 -fopenmp". * testsuite/libgomp.c++/pr64824.C: Same. * testsuite/libgomp.c++/pr64868.C: Same. * testsuite/libgomp.c++/pr66199-1.C: Same. * testsuite/libgomp.c++/pr66199-2.C: Same. * testsuite/libgomp.c++/target-2.C: Same. * testsuite/libgomp.c++/for-7.C: Use dg-additional-options for -std=<standard> option. * testsuite/libgomp.c++/udr-11.C: Same. * testsuite/libgomp.c++/udr-12.C: Same. * testsuite/libgomp.c++/udr-13.C: Same. * testsuite/libgomp.c++/udr-14.C: Same. * testsuite/libgomp.c++/udr-15.C: Same. * testsuite/libgomp.c++/udr-16.C: Same. * testsuite/libgomp.c++/udr-17.C: Same. * testsuite/libgomp.c++/udr-18.C: Same. * testsuite/libgomp.c++/udr-19.C: Same. * testsuite/libgomp.c++/atomic-1.C: Remove dg-options "-O2". * testsuite/libgomp.c++/simd-1.C: Same. * testsuite/libgomp.c++/simd-2.C: Same. * testsuite/libgomp.c++/simd-3.C: Same. * testsuite/libgomp.c++/simd-4.C: Same. * testsuite/libgomp.c++/simd-5.C: Same. * testsuite/libgomp.c++/simd-6.C: Same. * testsuite/libgomp.c++/simd-7.C: Same. * testsuite/libgomp.c++/simd-8.C: Same. * testsuite/libgomp.c++/simd-9.C: Same. * testsuite/libgomp.c++/simd10.C: Same. * testsuite/libgomp.c++/simd11.C: Same. * testsuite/libgomp.c++/simd12.C: Same. * testsuite/libgomp.c++/simd13.C: Same. From-SVN: r225181
2015-06-30 14:22:04 +02:00
// { dg-additional-options "-std=c++0x" }
extern "C" void abort ();
int cnt;
template <typename T>
void
f0 (T, int)
{
abort ();
}
template <>
void
f0<int> (int, int type)
{
if (type != 0)
abort ();
#pragma omp atomic
cnt++;
}
template <>
void
f0<const char *> (const char *, int type)
{
if (type != 1)
abort ();
#pragma omp atomic
cnt++;
}
template <typename T>
void
f1 ()
{
#pragma omp parallel for
for (auto i = 0; i < 10; i++)
f0 (i, 0);
}
template <typename T>
void
f2 ()
{
#pragma omp parallel for
for (auto i = T (0); i < T (10); i += T (1))
f0 (i, 0);
}
void
f3 ()
{
#pragma omp parallel for
for (auto i = 0; i < 10; i++)
f0 (i, 0);
}
const char *p = "abcdefghij";
template <typename T>
void
f4 ()
{
#pragma omp parallel for
for (auto i = p; i < p + 10; i++)
f0 (i, 1);
}
template <typename T>
void
f5 ()
{
#pragma omp parallel for
for (auto i = T (p); i < T (p + 10); i++)
f0 (i, 1);
}
void
f6 ()
{
#pragma omp parallel for
for (auto i = p; i < p + 10; i++)
f0 (i, 1);
}
int
main ()
{
f1<int> ();
if (cnt != 10)
abort ();
f2<int> ();
if (cnt != 20)
abort ();
f3 ();
if (cnt != 30)
abort ();
f4<int> ();
if (cnt != 40)
abort ();
f5<const char *> ();
if (cnt != 50)
abort ();
f6 ();
if (cnt != 60)
abort ();
}