Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 42cf0e7

Browse files
author
Sven Verdoolaege
committed
isSupportedReduction: check that call has at least one argument before accessing
Apparently, this currently does not trigger, but it could if this function ever gets reused in a more general context.
1 parent 4823738 commit 42cf0e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tc/core/polyhedral/reduction_matcher.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ namespace {
3939
bool isSupportedReduction(Halide::Internal::Stmt stmt) {
4040
auto provide = stmt.as<Halide::Internal::Provide>();
4141
auto call = provide->values[0].as<Halide::Internal::Call>();
42-
if (call && call->args[0].as<Halide::Internal::Add>()) {
42+
if (call && call->args.size() > 0 &&
43+
call->args[0].as<Halide::Internal::Add>()) {
4344
return true;
4445
}
4546
return false;

0 commit comments

Comments
 (0)