diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-12-01 15:10:25 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-12-01 15:10:25 +0000 |
commit | 5846b949460ea036e548e9a9fd72ae4c10993ce9 (patch) | |
tree | d549d9aed6ba1fe9b773286c6c92016841748612 /libgomp | |
parent | e52dd25836ec08885b8206b330060617281db851 (diff) | |
download | gcc-5846b949460ea036e548e9a9fd72ae4c10993ce9.tar.gz |
PR c++/38348
* c-omp.c (c_finish_omp_for): Only transform pointer
++ or -- into MODIFY_EXPR if second argument is non-NULL.
* g++.dg/gomp/for-19.C: New test.
* testsuite/libgomp.c++/for-6.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142318 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 5 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c++/for-6.C | 109 |
2 files changed, 114 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 0cdfba6d83f..5576af2049c 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2008-12-01 Jakub Jelinek <jakub@redhat.com> + + PR c++/38348 + * testsuite/libgomp.c++/for-6.C: New test. + 2008-11-26 Janis Johnson <janis187@us.ibm.com> PR testsuite/28870 diff --git a/libgomp/testsuite/libgomp.c++/for-6.C b/libgomp/testsuite/libgomp.c++/for-6.C new file mode 100644 index 00000000000..0da21ce2fe5 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/for-6.C @@ -0,0 +1,109 @@ +// PR c++/38348 +// { dg-do run } + +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 (int i = 0; i < 10; i++) + f0 (i, 0); +} + +template <typename T> +void +f2 () +{ +#pragma omp parallel for + for (T i = T (0); i < T (10); i += T (1)) + f0 (i, 0); +} + +void +f3 () +{ +#pragma omp parallel for + for (int i = 0; i < 10; i++) + f0 (i, 0); +} + +const char *p = "abcdefghij"; + +template <typename T> +void +f4 () +{ +#pragma omp parallel for + for (const char *i = p; i < p + 10; i += 1) + f0 (i, 1); +} + +template <typename T> +void +f5 () +{ +#pragma omp parallel for + for (T i = T (p); i < T (p + 10); i += 1) + f0 (i, 1); +} + +void +f6 () +{ +#pragma omp parallel for + for (const char *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 (); +} |