Investigating the armel build on the armmel porterbox (abel.debian.org). Commenting out line 1394 in gmock-matchers-misc_test.cc results in that the test succeeds:
EXPECT_THAT(some_list, Contains(3).Times(2));
EXPECT_THAT(some_list, Contains(2).Times(1));
EXPECT_THAT(some_list, Contains(Ge(2)).Times(3));
// EXPECT_THAT(some_list, Contains(Ge(2)).Times(Gt(2)));
EXPECT_THAT(some_list, Contains(4).Times(0));
EXPECT_THAT(some_list, Contains(_).Times(4));
EXPECT_THAT(some_list, Not(Contains(5).Times(1)));
Compiling the unmodified file with -O1 insted of -O2 also results in
that the test succeeds.
The output of the test says:
[ RUN ] ContainsTimes.ListMatchesWhenElementQuantityMatches
./googlemock/test/gmock-matchers-misc_test.cc:1394: Failure
Value of: some_list
Expected: quantity of elements that match is >= 2 is > 3
Actual: { 3, 1, 2, 3 }, whose elements (0, 2, 3) match but whose
match quantity of 3 does not match
[ FAILED ] ContainsTimes.ListMatchesWhenElementQuantityMatches (0 ms)
Contains(Ge(2)).Times(Gt(2)) should mean:
Expected: quantity of elements that match is >= 2 is > 2
But according to the test output the actual test performed is
Expected: quantity of elements that match is >= 2 is > 3
which fails.
It looks like a compiler bug. With -O2 the line
EXPECT_THAT(some_list, Contains(Ge(2)).Times(Gt(2)));
is miscompiled as
EXPECT_THAT(some_list, Contains(Ge(2)).Times(Gt(3)));
Consider reporting this against gcc-12 package.
Mattias Ellert
signature.asc
Description: This is a digitally signed message part

