diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-07-27 21:13:42 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-07-27 21:13:42 +0200 |
commit | a40ff0ae8b8d28d5713792ca108f688f2ca4825a (patch) | |
tree | 8e297a3f30cbc148915200b3e303439c75bae8c3 /libgomp | |
parent | 1f9e09b55416098b04b3071549cdd53ab95ff8b5 (diff) | |
download | gcc-a40ff0ae8b8d28d5713792ca108f688f2ca4825a.zip gcc-a40ff0ae8b8d28d5713792ca108f688f2ca4825a.tar.gz gcc-a40ff0ae8b8d28d5713792ca108f688f2ca4825a.tar.bz2 |
re PR c/45784 (gcc OpenMP - error: invalid controlling predicate)
PR c/45784
* c-omp.c (c_finish_omp_for): If the condition is wrapped in
rhs of COMPOUND_EXPR(s), skip them and readd their lhs into
new COMPOUND_EXPRs around the rhs of the comparison.
* testsuite/libgomp.c/pr45784.c: New test.
* testsuite/libgomp.c++/pr45784.C: New test.
From-SVN: r250635
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 6 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c++/pr45784.C | 5 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/pr45784.c | 41 |
3 files changed, 52 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 187f5a3..0e6258f 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,9 @@ +2017-07-27 Jakub Jelinek <jakub@redhat.com> + + PR c/45784 + * testsuite/libgomp.c/pr45784.c: New test. + * testsuite/libgomp.c++/pr45784.C: New test. + 2017-07-19 Tom de Vries <tom@codesourcery.com> * testsuite/libgomp.oacc-c/vec.c: New test. diff --git a/libgomp/testsuite/libgomp.c++/pr45784.C b/libgomp/testsuite/libgomp.c++/pr45784.C new file mode 100644 index 0000000..306246c --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr45784.C @@ -0,0 +1,5 @@ +// PR c/45784 +// { dg-do run } + +#include "../libgomp.c/pr45784.c" + diff --git a/libgomp/testsuite/libgomp.c/pr45784.c b/libgomp/testsuite/libgomp.c/pr45784.c new file mode 100644 index 0000000..7861210 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr45784.c @@ -0,0 +1,41 @@ +/* PR c/45784 */ +/* { dg-do run } */ + +void +foo (int n) +{ + char *p, vla[2 * n]; + int i; + #pragma omp parallel for + for (p = vla; p < vla + (sizeof (vla) / sizeof (vla[0])); p++) + *p = ' '; + #pragma omp parallel for + for (i = 0; i < 2 * n; i++) + if (vla[i] != ' ') + __builtin_abort (); +} + +void +bar (int n) +{ + char *p, vla1[n], vla2[n * 2], vla3[n * 3], vla4[n * 4]; + int i; + __builtin_memset (vla4, ' ', n * 4); + #pragma omp parallel for + for (p = vla4 + sizeof (vla1); p < vla4 + sizeof (vla3) - sizeof (vla2) + sizeof (vla1); p += sizeof (vla4) / sizeof (vla4)) + p[0] = '!'; + #pragma omp parallel for + for (i = 0; i < n * 4; i++) + if (vla4[i] != ((i >= n && i < 2 * n) ? '!' : ' ')) + __builtin_abort (); +} + +int +main () +{ + volatile int n; + n = 128; + foo (n); + bar (n); + return 0; +} |