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:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user