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.
This commit is contained in:
Thomas Schwinge 2021-08-11 11:59:19 +02:00
parent df98015fb7
commit a2ab2f0dfb
1 changed files with 3 additions and 3 deletions

View File

@ -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));
}