[cfe-commits] [PATCH] Generic_GCC::GCCVersion comparison fix

Simon Atanasyan satanasyan at mips.com
Wed Dec 12 03:32:33 PST 2012


Hi,

It looks like comparison operators in the "Generic_GCC::GCCVersion"
class work incorrectly if we want to compare equal versions without
patch numbers.

The problem is in the following line of code:
[[
if (RHS.Patch == -1) return true; if (Patch == -1) return false;
]]

Suppose we have two GCCVersion objects A and B both represent say 4.7.
In that case A < B is true as well as B < A because right operand has
no patch number in both cases. Consequently A <= B and B <= A are both
false.

Is this intended behavior? If not, please review the patch fixes this
problem. Unfortunately I cannot figure out how to write a test for
that case.

--
Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ver-cmp.patch
Type: application/octet-stream
Size: 754 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121212/cc9fb541/attachment.obj>


More information about the cfe-commits mailing list