diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2021-08-11 11:59:19 +0200 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2021-08-16 12:12:09 +0200 |
commit | a2ab2f0dfba0fa69ebf6c82e34750911b2e5a639 (patch) | |
tree | 1b1fd3368a3e182a1481c157bdb813ede79de397 | |
parent | df98015fb7db2ed754a7c154669bc7777f8e1612 (diff) | |
download | gcc-a2ab2f0dfba0fa69ebf6c82e34750911b2e5a639.zip gcc-a2ab2f0dfba0fa69ebf6c82e34750911b2e5a639.tar.gz gcc-a2ab2f0dfba0fa69ebf6c82e34750911b2e5a639.tar.bz2 |
Address '?:' issues in 'libgomp.oacc-c-c++-common/mode-transitions.c'
[...]/libgomp.oacc-c-c++-common/mode-transitions.c: In function ‘t3’:
[...]/libgomp.oacc-c-c++-common/mode-transitions.c:127:43: warning: ‘?:’ using integer constants in boolean context, the expression will always evaluate to ‘true’ [-Wint-in-bool-context]
127 | assert (arr[i] == ((i % 64) < 32) ? 1 : -1);
| ^
[...]/libgomp.oacc-c-c++-common/mode-transitions.c: In function ‘t9’:
[...]/libgomp.oacc-c-c++-common/mode-transitions.c:359:46: warning: ‘?:’ using integer constants in boolean context, the expression will always evaluate to ‘true’ [-Wint-in-bool-context]
359 | assert (arr[i] == ((i % 3) == 0) ? 1 : 2);
| ^
..., and PR101862 "[C, C++] Potential '?:' diagnostic for always-true
expressions in boolean context".
libgomp/
* testsuite/libgomp.oacc-c-c++-common/mode-transitions.c: Address
'?:' issues.
-rw-r--r-- | libgomp/testsuite/libgomp.oacc-c-c++-common/mode-transitions.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/mode-transitions.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/mode-transitions.c index 6c989ab..94dc9d0 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/mode-transitions.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/mode-transitions.c @@ -124,7 +124,7 @@ void t3() assert (n[i] == 2); for (i = 0; i < 1024; i++) - assert (arr[i] == ((i % 64) < 32) ? 1 : -1); + assert (arr[i] == (((i % 64) < 32) ? 1 : -1)); } @@ -356,7 +356,7 @@ void t9() } for (i = 0; i < 1024; i++) - assert (arr[i] == ((i % 3) == 0) ? 1 : 2); + assert (arr[i] == ((i % 3) == 0 ? 1 : 2)); } } @@ -960,7 +960,7 @@ void t23() } for (i = 0; i < 32; i++) - assert (arr[i] == ((i % 2) != 0) ? i + 1 : i + 2); + assert (arr[i] == (((i % 2) != 0) ? i + 1 : i + 2)); } |