Skip to content

Commit

Permalink
spirv-fuzz: Pass OpUndef in function call if needed (#3978)
Browse files Browse the repository at this point in the history
Fixes #3977.
  • Loading branch information
afd authored Oct 22, 2020
1 parent de2c0ba commit 53f2a69
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions source/fuzz/fuzzer_pass_add_function_calls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,13 @@ std::vector<uint32_t> FuzzerPassAddFunctionCalls::ChooseFunctionCallArguments(
assert(param_type && "Parameter has invalid type");

if (!param_type->AsPointer()) {
// We mark the constant as irrelevant so that we can replace it with a
// more interesting value later.
result.push_back(FindOrCreateZeroConstant(param->type_id(), true));
if (fuzzerutil::CanCreateConstant(GetIRContext(), param->type_id())) {
// We mark the constant as irrelevant so that we can replace it with a
// more interesting value later.
result.push_back(FindOrCreateZeroConstant(param->type_id(), true));
} else {
result.push_back(FindOrCreateGlobalUndef(param->type_id()));
}
continue;
}

Expand Down

0 comments on commit 53f2a69

Please sign in to comment.