From: Julian Brown Date: Sun, 29 Apr 2018 10:26:56 +0000 (+0000) Subject: [openacc, testsuite] Fix undefined behaviour in atomic_capture-1.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8d70b61edda10e97686da47decfc7f93ff0bc7c9;p=gcc.git [openacc, testsuite] Fix undefined behaviour in atomic_capture-1.c 2018-04-29 Julian Brown Tom de Vries PR testsuite/85527 * testsuite/libgomp.oacc-c-c++-common/atomic_capture-1.c: Allow arbitrary order for iterations of atomic subtract check. Co-Authored-By: Tom de Vries From-SVN: r259748 --- diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 0ba1bbef492..49364dac094 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,10 @@ +2018-04-29 Julian Brown + Tom de Vries + + PR testsuite/85527 + * testsuite/libgomp.oacc-c-c++-common/atomic_capture-1.c: Allow + arbitrary order for iterations of atomic subtract check. + 2018-04-28 Tom de Vries PR testsuite/85527 diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/atomic_capture-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/atomic_capture-1.c index ad958cd1f9e..9b71a0875ad 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/atomic_capture-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/atomic_capture-1.c @@ -795,17 +795,16 @@ main(int argc, char **argv) } } + int ones = 0, thirtyones = 0; + for (i = 0; i < N; i++) - if (i % 2 == 0) - { - if (fdata[i] != 31.0) - abort (); - } - else - { - if (fdata[i] != 1.0) - abort (); - } + if (fdata[i] == 31.0) + thirtyones++; + else if (fdata[i] == 1.0) + ones++; + + if (ones != N / 2 || thirtyones != N / 2) + abort (); /* BINOP = / */