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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Dec 12 21:17:16 PST 2012

On 12 December 2012 06:32, Simon Atanasyan <satanasyan at mips.com> wrote:
> 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.


I can get the current code to fail if I, for example, create a
I am not sure if that is a valid directory layout or not, so we should
wait on Chandler for the test, but the fix itself is OK.

> --
> Simon


More information about the cfe-commits mailing list