diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-08-07 18:34:29 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-08-07 18:34:29 +0000 |
commit | b4ae034c3ad20b6f4f6d79c4d145b508d9e5abe8 (patch) | |
tree | c89ce11c83972621f5a37972d6d1ac9a7b80144e /libgomp | |
parent | 0b3bf55cacb7245c183e14c51f5983d03f480785 (diff) | |
download | gcc-b4ae034c3ad20b6f4f6d79c4d145b508d9e5abe8.tar.gz |
PR c/69389
* gimplify.c (goa_stabilize_expr): Handle BIT_INSERT_EXPR and
BIT_FIELD_REF.
* c-omp.c (c_finish_omp_atomic): Handle atomics on bitfields.
* testsuite/libgomp.c/pr69389.c: New test.
* testsuite/libgomp.c++/pr69389.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250929 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 6 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c++/pr69389.C | 3 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/pr69389.c | 124 |
3 files changed, 133 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 62d4f27d2f3..f17a17b138d 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,9 @@ +2017-08-07 Jakub Jelinek <jakub@redhat.com> + + PR c/69389 + * testsuite/libgomp.c/pr69389.c: New test. + * testsuite/libgomp.c++/pr69389.C: New test. + 2017-08-07 Tom de Vries <tom@codesourcery.com> PR middle-end/78266 diff --git a/libgomp/testsuite/libgomp.c++/pr69389.C b/libgomp/testsuite/libgomp.c++/pr69389.C new file mode 100644 index 00000000000..9fcb0ffc6d0 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr69389.C @@ -0,0 +1,3 @@ +// PR c/69389 + +#include "../libgomp.c/pr69389.c" diff --git a/libgomp/testsuite/libgomp.c/pr69389.c b/libgomp/testsuite/libgomp.c/pr69389.c new file mode 100644 index 00000000000..07faff46f40 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr69389.c @@ -0,0 +1,124 @@ +/* PR c/69389 */ + +struct S { unsigned int a : 10; unsigned int b : 4; unsigned int c : 18; } s = { 210, 11, 1235 }; + +unsigned int +f1 (void) +{ + unsigned int v; + #pragma omp atomic read + v = s.b; + return v; +} + +void +f2 (unsigned int v) +{ + #pragma omp atomic write + s.b = v; +} + +void +f3 (void) +{ + #pragma omp atomic + s.b |= 1; +} + +int +f4 (void) +{ + int v; + #pragma omp atomic capture + v = s.b += 8; + return v; +} + +int +f5 (void) +{ + int v; + #pragma omp atomic capture + { + v = s.b; + s.b -= 4; + } + return v; +} + +void +f6 (void) +{ + #pragma omp atomic + s.b = s.b & 7; +} + +void +f7 (void) +{ + #pragma omp atomic + s.b = ~7 & s.b; +} + +int +f8 (void) +{ + int v; + #pragma omp atomic capture + v = s.b = 8 + s.b; + return v; +} + +int +f9 (void) +{ + int v; + #pragma omp atomic capture + { + v = s.b; + s.b = s.b - 4; + } + return v; +} + +int +main () +{ + if (f1 () != 11) + __builtin_abort (); + f2 (4); + if (s.a != 210 || s.b != 4 || s.c != 1235) + __builtin_abort (); + s.a = 813; + s.c = 31532; + if (f1 () != 4) + __builtin_abort (); + f3 (); + if (f1 () != 5) + __builtin_abort (); + if (s.a != 813 || s.b != 5 || s.c != 31532) + __builtin_abort (); + if (f4 () != 13) + __builtin_abort (); + if (f1 () != 13) + __builtin_abort (); + f2 (14); + if (s.a != 813 || s.b != 14 || s.c != 31532) + __builtin_abort (); + if (f5 () != 14) + __builtin_abort (); + if (f1 () != 10 || s.a != 813 || s.b != 10 || s.c != 31532) + __builtin_abort (); + f6 (); + if (f1 () != 2) + __builtin_abort (); + f2 (15); + f7 (); + if (f1 () != 8) + __builtin_abort (); + if (f8 () != 0 || s.a != 813 || s.b != 0 || s.c != 31532) + __builtin_abort (); + if (f9 () != 0 || s.a != 813 || s.b != 12 || s.c != 31532) + __builtin_abort (); + return 0; +} |