Skip to content

C/C++ compilation warnings about comparing signed and unsigned integers #5322

@wangkuiyi

Description

@wangkuiyi
[14:46:46]	In file included from /paddle/paddle/optimizer/parameter_optimizer_test.cpp:21:0:
[14:46:46]	/paddle/build/third_party/install/gtest/include/gtest/gtest.h: In instantiation of 'testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = int; T2 = long unsigned int]':
[14:46:46]	/paddle/build/third_party/install/gtest/include/gtest/gtest.h:1421:23: required from 'static testing::AssertionResult testing::internal::EqHelper<lhs_is_null_literal>::Compare(const char*, const char*, const T1&, const T2&) [with T1 = int; T2 = long unsigned int; bool lhs_is_null_literal = false]'
[14:46:46]	/paddle/paddle/optimizer/parameter_optimizer_test.cpp:88:7: required from here
[14:46:46]	/paddle/build/third_party/install/gtest/include/gtest/gtest.h:1392:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
[14:46:46]	if (lhs == rhs) {
[14:46:46]
[14:46:30]	In file included from /paddle/paddle/framework/attribute.h:25:0,
[14:46:30]	from /paddle/paddle/framework/op_info.h:21,
[14:46:30]	from /paddle/paddle/framework/executor.h:17,
[14:46:30]	from /paddle/paddle/framework/executor.cc:15:
[14:46:30]	/paddle/paddle/framework/executor.cc: In member function 'void paddle::framework::Executor::Run(const paddle::framework::ProgramDescBind&, paddle::framework::Scope*, int, bool)':
[14:46:30]	/paddle/paddle/platform/enforce.h:236:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
[14:46:30]	__PADDLE_BINARY_COMPARE(__VAL0, __VAL1, <, >=, __VA_ARGS__)
[14:46:30]	^
[14:46:30]	/paddle/paddle/platform/enforce.h:207:42: note: in definition of macro 'PADDLE_ENFORCE'
[14:46:30]	::paddle::platform::throw_on_error(__VA_ARGS__); \
[14:46:30]	^
[14:46:30]	/paddle/paddle/platform/enforce.h:236:3: note: in expansion of macro '__PADDLE_BINARY_COMPARE'
[14:46:30]	__PADDLE_BINARY_COMPARE(__VAL0, __VAL1, <, >=, __VA_ARGS__)
[14:46:30]	^
[14:46:30]	/paddle/paddle/framework/executor.cc:86:3: note: in expansion of macro 'PADDLE_ENFORCE_LT'
[14:46:30]	PADDLE_ENFORCE_LT(block_id, pdesc.Size());
[14:46:30]
[14:46:08]	In file included from /paddle/paddle/framework/attribute.h:25:0,
[14:46:08]	from /paddle/paddle/framework/op_registry.h:25,
[14:46:08]	from /paddle/paddle/operators/seq_expand_op.h:17,
[14:46:08]	from /paddle/paddle/operators/seq_expand_op.cc:15:
[14:46:08]	/paddle/paddle/operators/seq_expand_op.h: In instantiation of 'void paddle::operators::SeqExpandKernel<Place, T>::Compute(const paddle::framework::ExecutionContext&) const [with Place = paddle::platform::CPUPlace; T = float]':
[14:46:08]	/paddle/paddle/operators/seq_expand_op.cc:153:65: required from here
[14:46:08]	/paddle/paddle/platform/enforce.h:228:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
[14:46:08]	__PADDLE_BINARY_COMPARE(__VAL0, __VAL1, ==, !=, __VA_ARGS__)
[14:46:08]	^
[14:46:08]	/paddle/paddle/platform/enforce.h:207:42: note: in definition of macro 'PADDLE_ENFORCE'
[14:46:08]	::paddle::platform::throw_on_error(__VA_ARGS__); \
[14:46:08]	^
[14:46:08]	/paddle/paddle/platform/enforce.h:228:3: note: in expansion of macro '__PADDLE_BINARY_COMPARE'
[14:46:08]	__PADDLE_BINARY_COMPARE(__VAL0, __VAL1, ==, !=, __VA_ARGS__)
[14:46:08]	^
[14:46:08]	/paddle/paddle/operators/seq_expand_op.h:35:5: note: in expansion of macro 'PADDLE_ENFORCE_EQ'
[14:46:08]	PADDLE_ENFORCE_EQ(x_dims[0], y->lod().back().size() - 1,
[14:46:08]
[14:43:23]	In file included from /paddle/paddle/framework/ddim.h:21:0,
[14:43:23]	from /paddle/paddle/framework/tensor.h:23,
[14:43:23]	from /paddle/paddle/framework/eigen.h:17,
[14:43:23]	from /paddle/paddle/operators/linear_chain_crf_op.h:16,
[14:43:23]	from /paddle/paddle/operators/linear_chain_crf_op.cc:15:
[14:43:23]	/paddle/paddle/operators/linear_chain_crf_op.h: In instantiation of 'T paddle::operators::LinearChainCRFOpKernel<Place, T>::ForwardOneSequence(const paddle::framework::Tensor&, const paddle::framework::Tensor&, const paddle::framework::Tensor&, const paddle::framework::Tensor&, const paddle::framework::Tensor&, const paddle::framework::Tensor&, paddle::framework::Tensor*) const [with Place = paddle::platform::CPUPlace; T = double]':
[14:43:23]	/paddle/paddle/operators/linear_chain_crf_op.h:171:45: required from 'void paddle::operators::LinearChainCRFOpKernel<Place, T>::Compute(const paddle::framework::ExecutionContext&) const [with Place = paddle::platform::CPUPlace; T = double]'
[14:43:23]	/paddle/paddle/operators/linear_chain_crf_op.cc:261:73: required from here
[14:43:23]	/paddle/paddle/platform/enforce.h:236:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
[14:43:23]	__PADDLE_BINARY_COMPARE(__VAL0, __VAL1, <, >=, __VA_ARGS__)
[14:43:23]
[14:43:12]	/paddle/paddle/operators/linear_chain_crf_op.h: In instantiation of 'T paddle::operators::LinearChainCRFOpKernel<Place, T>::ForwardOneSequence(const paddle::framework::Tensor&, const paddle::framework::Tensor&, const paddle::framework::Tensor&, const paddle::framework::Tensor&, const paddle::framework::Tensor&, const paddle::framework::Tensor&, paddle::framework::Tensor*) const [with Place = paddle::platform::GPUPlace; T = double]':
[14:43:12]	/paddle/paddle/operators/linear_chain_crf_op.h:171:41: required from 'void paddle::operators::LinearChainCRFOpKernel<Place, T>::Compute(const paddle::framework::ExecutionContext&) const [with Place = paddle::platform::GPUPlace; T = double]'
[14:43:12]	/tmp/tmpxft_000048dc_00000000-4_linear_chain_crf_op.compute_60.cudafe1.stub.c:12:27: required from here
[14:43:12]	/paddle/paddle/operators/linear_chain_crf_op.h:275:90: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
[14:43:12]	/paddle/paddle/operators/linear_chain_crf_op.h: In instantiation of 'T paddle::operators::LinearChainCRFOpKernel<Place, T>::ForwardOneSequence(const paddle::framework::Tensor&, const paddle::framework::Tensor&, const paddle::framework::Tensor&, const paddle::framework::Tensor&, const paddle::framework::Tensor&, const paddle::framework::Tensor&, paddle::framework::Tensor*) const [with Place = paddle::platform::GPUPlace; T = float]':
[14:43:12]	/paddle/paddle/operators/linear_chain_crf_op.h:171:41: required from 'void paddle::operators::LinearChainCRFOpKernel<Place, T>::Compute(const paddle::framework::ExecutionContext&) const [with Place = paddle::platform::GPUPlace; T = float]'
[14:43:12]	/tmp/tmpxft_000048dc_00000000-4_linear_chain_crf_op.compute_60.cudafe1.stub.c:12:27: required from here
[14:43:12]	/paddle/paddle/operators/linear_chain_crf_op.h:275:90: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
[14:41:03]	In file included from /paddle/build/third_party/install/protobuf/include/google/protobuf/stubs/common.h:40:0,
[14:41:03]	from /paddle/build/proto/ModelConfig.pb.h:9,
[14:41:03]	from /paddle/paddle/gserver/evaluators/Evaluator.h:18,
[14:41:03]	from /paddle/paddle/gserver/evaluators/Evaluator.cpp:15:
[14:41:03]	/paddle/build/third_party/install/glog/include/glog/logging.h: In instantiation of 'std::__cxx11::string* google::Check_EQImpl(const T1&, const T2&, const char*) [with T1 = int; T2 = long unsigned int; std::__cxx11::string = std::__cxx11::basic_string<char>]':
[14:41:03]	/paddle/paddle/gserver/evaluators/Evaluator.cpp:410:5: required from here
[14:41:03]	/paddle/build/third_party/install/glog/include/glog/logging.h:717:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
[14:41:03]	DEFINE_CHECK_OP_IMPL(Check_EQ, ==) // Compilation error with CHECK_EQ(NULL, x)?
[14:41:03]	^
[14:41:03]	/paddle/build/third_party/install/protobuf/include/google/protobuf/stubs/port.h:200:53: note: in definition of macro 'GOOGLE_PREDICT_TRUE'
[14:41:03]	#define GOOGLE_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
[14:41:03]	^
[14:41:03]	/paddle/build/third_party/install/glog/include/glog/logging.h:717:1: note: in expansion of macro 'DEFINE_CHECK_OP_IMPL'
[14:41:03]	DEFINE_CHECK_OP_IMPL(Check_EQ, ==) // Compilation error with CHECK_EQ(NULL, x)?
[14:41:03]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions