diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-12-28 20:06:00 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-12-28 20:06:00 +0000 |
commit | 267f2f49b76324f5a393e4cddc9c899e7a6bd894 (patch) | |
tree | f612b0b6482de3bfab5e984231c0d017244573cb /libgomp | |
parent | f2bb0caab3f1442550fc59770df22b1b770a55b1 (diff) | |
download | gcc-267f2f49b76324f5a393e4cddc9c899e7a6bd894.tar.gz |
PR c++/38650
* semantics.c (finish_omp_for): Don't add CLEANUP_POINT_EXPR
around volatile iteration var in condition and/or increment
expression.
* testsuite/libgomp.c/pr38650.c: New test.
* testsuite/libgomp.c++/pr38650.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142940 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 6 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c++/pr38650.C | 49 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/pr38650.c | 49 |
3 files changed, 104 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 3859e608313..d8e91b340d0 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,9 @@ +2008-12-28 Jakub Jelinek <jakub@redhat.com> + + PR c++/38650 + * testsuite/libgomp.c/pr38650.c: New test. + * testsuite/libgomp.c++/pr38650.C: New test. + 2008-12-27 Jakub Jelinek <jakub@redhat.com> * testsuite/libgomp.c/collapse-1.c (main): Add private(k) clause. diff --git a/libgomp/testsuite/libgomp.c++/pr38650.C b/libgomp/testsuite/libgomp.c++/pr38650.C new file mode 100644 index 00000000000..ebe221adcd5 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr38650.C @@ -0,0 +1,49 @@ +// PR c++/38650 +// { dg-do run } + +#include <cstdlib> + +int e; + +int +main () +{ + volatile int i, j = 10; + e = 0; +#pragma omp parallel for reduction(+:e) + for (i = 0; i < j; i += 1) + e++; + if (e != 10) + std::abort (); + e = 0; +#pragma omp parallel for reduction(+:e) + for (i = 0; i < j; ++i) + e++; + if (e != 10) + std::abort (); + e = 0; +#pragma omp parallel for reduction(+:e) + for (i = 0; i < j; i++) + e++; + if (e != 10) + std::abort (); + e = 0; +#pragma omp parallel for reduction(+:e) + for (i = 0; i < 10; i += 1) + e++; + if (e != 10) + std::abort (); + e = 0; +#pragma omp parallel for reduction(+:e) + for (i = 0; i < 10; ++i) + e++; + if (e != 10) + std::abort (); + e = 0; +#pragma omp parallel for reduction(+:e) + for (i = 0; i < 10; i++) + e++; + if (e != 10) + std::abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/pr38650.c b/libgomp/testsuite/libgomp.c/pr38650.c new file mode 100644 index 00000000000..7066239b070 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr38650.c @@ -0,0 +1,49 @@ +/* PR c++/38650 */ +/* { dg-do run } */ + +#include <stdlib.h> + +int e; + +int +main () +{ + volatile int i, j = 10; + e = 0; +#pragma omp parallel for reduction(+:e) + for (i = 0; i < j; i += 1) + e++; + if (e != 10) + abort (); + e = 0; +#pragma omp parallel for reduction(+:e) + for (i = 0; i < j; ++i) + e++; + if (e != 10) + abort (); + e = 0; +#pragma omp parallel for reduction(+:e) + for (i = 0; i < j; i++) + e++; + if (e != 10) + abort (); + e = 0; +#pragma omp parallel for reduction(+:e) + for (i = 0; i < 10; i += 1) + e++; + if (e != 10) + abort (); + e = 0; +#pragma omp parallel for reduction(+:e) + for (i = 0; i < 10; ++i) + e++; + if (e != 10) + abort (); + e = 0; +#pragma omp parallel for reduction(+:e) + for (i = 0; i < 10; i++) + e++; + if (e != 10) + abort (); + return 0; +} |