00001
00002
00003
00004 extern "C" void abort ();
00005
00006 template <typename T, T M, T N>
00007 void
00008 f1 ()
00009 {
00010 int c;
00011 T i;
00012 c = 0;
00013 #pragma omp parallel for reduction(+:c)
00014 for (i = M; i < N; i++)
00015 c++;
00016 if (c != 1)
00017 abort ();
00018 }
00019
00020 template <typename T, T M, T N>
00021 void
00022 f2 ()
00023 {
00024 int c;
00025 T i;
00026 c = 0;
00027 #pragma omp parallel for reduction(+:c)
00028 for (i = M; i <= N; i++)
00029 c++;
00030 if (c != 1)
00031 abort ();
00032 }
00033
00034 template <typename T, T M, T N>
00035 void
00036 f3 ()
00037 {
00038 int c;
00039 T i;
00040 c = 0;
00041 #pragma omp parallel for reduction(+:c)
00042 for (i = M; i > N; i--)
00043 c++;
00044 if (c != 1)
00045 abort ();
00046 }
00047
00048 template <typename T, T M, T N>
00049 void
00050 f4 ()
00051 {
00052 int c;
00053 T i;
00054 c = 0;
00055 #pragma omp parallel for reduction(+:c)
00056 for (i = M; i >= N; i--)
00057 c++;
00058 if (c != 1)
00059 abort ();
00060 }
00061
00062 int
00063 main ()
00064 {
00065 int c;
00066 unsigned int i;
00067 int j;
00068 c = 0;
00069 #pragma omp parallel for reduction(+:c)
00070 for (i = 0; i < 1; i++)
00071 c++;
00072 if (c != 1)
00073 abort ();
00074 f1 <unsigned int, 0, 1> ();
00075 c = 0;
00076 #pragma omp parallel for reduction(+:c)
00077 for (i = 0; i <= 0; i++)
00078 c++;
00079 if (c != 1)
00080 abort ();
00081 f2 <unsigned int, 0, 0> ();
00082 c = 0;
00083 #pragma omp parallel for reduction(+:c)
00084 for (j = - __INT_MAX__ - 1; j < - __INT_MAX__; j++)
00085 c++;
00086 if (c != 1)
00087 abort ();
00088 f1 <int, (- __INT_MAX__ - 1), (- __INT_MAX__)> ();
00089 c = 0;
00090 #pragma omp parallel for reduction(+:c)
00091 for (j = - __INT_MAX__ - 1; j <= - __INT_MAX__ - 1; j++)
00092 c++;
00093 if (c != 1)
00094 abort ();
00095 f2 <int, (- __INT_MAX__ - 1), (- __INT_MAX__ - 1)> ();
00096 c = 0;
00097 #pragma omp parallel for reduction(+:c)
00098 for (i = 2U * __INT_MAX__ + 1; i > 2U * __INT_MAX__; i--)
00099 c++;
00100 if (c != 1)
00101 abort ();
00102 f3 <unsigned int, (2U * __INT_MAX__ + 1), (2U * __INT_MAX__)> ();
00103 c = 0;
00104 #pragma omp parallel for reduction(+:c)
00105 for (i = 2U * __INT_MAX__ + 1; i >= 2U * __INT_MAX__ + 1; i--)
00106 c++;
00107 if (c != 1)
00108 abort ();
00109 f4 <unsigned int, (2U * __INT_MAX__ + 1), (2U * __INT_MAX__ + 1)> ();
00110 c = 0;
00111 #pragma omp parallel for reduction(+:c)
00112 for (j = __INT_MAX__; j > __INT_MAX__ - 1; j--)
00113 c++;
00114 if (c != 1)
00115 abort ();
00116 f3 <int, __INT_MAX__, (__INT_MAX__ - 1)> ();
00117 c = 0;
00118 #pragma omp parallel for reduction(+:c)
00119 for (j = __INT_MAX__; j >= __INT_MAX__; j--)
00120 c++;
00121 if (c != 1)
00122 abort ();
00123 f4 <int, __INT_MAX__, __INT_MAX__> ();
00124 return 0;
00125 }