From 29e68f5f86c2ca9346b5c3b9399381949c1923e9 Mon Sep 17 00:00:00 2001
From: Tianqi Chen <tqchen@users.noreply.github.com>
Date: Wed, 28 Feb 2018 08:55:07 -0800
Subject: [PATCH] Fix compiler warnings (#939)

---
 src/codegen/spirv/ir_builder.cc | 3 ++-
 src/codegen/spirv/ir_builder.h  | 2 +-
 topi/include/topi/nn/softmax.h  | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/codegen/spirv/ir_builder.cc b/src/codegen/spirv/ir_builder.cc
index 500c88ae8..2bd1d0d5d 100644
--- a/src/codegen/spirv/ir_builder.cc
+++ b/src/codegen/spirv/ir_builder.cc
@@ -159,7 +159,8 @@ Value IRBuilder::FloatImm(const SType& dtype, double value) {
     return GetConst_(dtype, reinterpret_cast<uint64_t*>(&value));
   } else if (dtype.type.bits() == 32) {
     float fvalue = static_cast<float>(value);
-    uint64_t data =  reinterpret_cast<uint32_t*>(&fvalue)[0];
+    uint32_t* ptr = reinterpret_cast<uint32_t*>(&fvalue);
+    uint64_t data = ptr[0];
     return GetConst_(dtype, &data);
   } else {
     CHECK_EQ(dtype.type.bits(), 16);
diff --git a/src/codegen/spirv/ir_builder.h b/src/codegen/spirv/ir_builder.h
index bdb320154..e652a0068 100644
--- a/src/codegen/spirv/ir_builder.h
+++ b/src/codegen/spirv/ir_builder.h
@@ -344,7 +344,7 @@ class IRBuilder {
    * \tparams Args The positional arguments
    */
   template<typename... Args>
-  Value DeclareGlobal(spv::Op op, Args&& ...args) {
+  void DeclareGlobal(spv::Op op, Args&& ...args) {
     ib_.Begin(op).AddSeq(std::forward<Args>(args)...).Commit(&decorate_);
   }
   /*!
diff --git a/topi/include/topi/nn/softmax.h b/topi/include/topi/nn/softmax.h
index d2348c9f2..f542f0eb0 100644
--- a/topi/include/topi/nn/softmax.h
+++ b/topi/include/topi/nn/softmax.h
@@ -47,7 +47,7 @@ inline Tensor softmax(const Tensor &x,
     Array<Expr> eval_range;
     int arg_counter = 0;
     for (size_t i = 0; i < ndim; ++i) {
-      if (i == axis)
+      if (static_cast<int>(i) == axis)
         eval_range.push_back(reduce_index);
       else
         eval_range.push_back(indices[arg_counter++]);
@@ -70,7 +70,7 @@ inline Tensor softmax(const Tensor &x,
                         const Array<Var> &indices) {
     Array<Expr> non_reduce_indices;
     for (size_t i = 0; i < ndim; ++i) {
-      if (i != axis)
+      if (static_cast<int>(i) != axis)
         non_reduce_indices.push_back(indices[i]);
     }
     return tvm::exp(x(indices) - max_elem(non_reduce_indices)) /
-- 
GitLab