diff --git a/topi/include/topi/detail/broadcast.h b/topi/include/topi/detail/broadcast.h
index ba7193cd06471d55bc67ebd56f465f16937ec95a..d76aa7d0ec564153e70b724382358027cd58a7f0 100644
--- a/topi/include/topi/detail/broadcast.h
+++ b/topi/include/topi/detail/broadcast.h
@@ -55,7 +55,7 @@ inline BroadcastHelper BroadcastShape(const tvm::Array<tvm::Expr>& shape1,
   auto max_size = std::max(s1_size, s2_size);
   auto& shape = (s1_size > s2_size) ? shape1 : shape2;
   auto& vars = (s1_size > s2_size) ? bh.vars1 : bh.vars2;
-  for (i = i; i <= max_size; ++i) {
+  for (; i <= max_size; ++i) {
     bh.all_vars.push_front(tvm::Var());
     bh.common_shape.push_front(shape[max_size - i]);
     vars.push_front(bh.all_vars[0]);