Bugzilla – Bug 1369
[LLVM] error: comparison of unsigned expression < 0 is always false
Last modified: 2012-03-18 07:11:18 UTC
With clang++ 2.9: [ 856/1334] cxx: src/dsdv/model/dsdv-routing-protocol.cc -> build/src/dsdv/model/dsdv-routing-protocol.cc.1.o ../src/dsdv/model/dsdv-routing-protocol.cc:843:25: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare] if (allRoutes.size () < 0) ~~~~~~~~~~~~~~~~~ ^ ~ 1 error generated.
Created attachment 1355 [details] Removes the if that is never executed Patch to solve the "comparison of unsigned expression < 0 is always false" error message of clang. The path removes the if, this solution should be evaluate by the maintainer of the module to be sure it is correct.
I disagree with the patch. The correct fix is: if (allRoutes.size () == 0) { return; } or, better if (allRoutes.empty()) { return; } On the other hand, later the map is traversed with an iterator. Thus removing the if() is not introducing a bug, it's just removing an optimization (it wasn't working anyway right now). T.
Created attachment 1361 [details] patch to fix bug 1369 in dsdv-routing-protocol.cc Yes, I agree. we need this if statement. Here is the patch that fixes this bug.
Marking this bug as fixed. Daniel, can you please upload this patch to the repository?
Pushed to changeset 7767 - 657d0877064e