mirror of
https://github.com/RPCSX/SPIRV-Tools.git
synced 2024-11-27 13:20:23 +00:00
Avoid bitwise and in boolean expression (#4603)
In #3404 a logical && was replaced with a bitwise & to ensure that both side-effecting arguments were evaluated. However, this leads to warnings from some compilers (leading to the OSS-Fuzz build breaking, in particular). This change reworks the relevant code so that both arguments to the logical && are evaluated into temporaries.
This commit is contained in:
parent
e3c7098104
commit
97d4495600
@ -659,9 +659,9 @@ spv_result_t ValidateStructuredSelections(
|
||||
// Mark the upcoming blocks as seen now, but only error out if this block
|
||||
// was missing a merge instruction and both labels hadn't been seen
|
||||
// previously.
|
||||
const bool both_unseen =
|
||||
seen.insert(true_label).second & seen.insert(false_label).second;
|
||||
if (!merge && both_unseen) {
|
||||
const bool true_label_unseen = seen.insert(true_label).second;
|
||||
const bool false_label_unseen = seen.insert(false_label).second;
|
||||
if (!merge && true_label_unseen && false_label_unseen) {
|
||||
return _.diag(SPV_ERROR_INVALID_CFG, terminator)
|
||||
<< "Selection must be structured";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user