FreeBSD user willing to try fix a unit test?

Hi all

In unittests/ADT/APIntTest.cpp I came across this test:

// XFAIL this test on FreeBSD where the system gcc-4.2.1 seems to miscompile it.
#if defined(llvm) || !defined(FreeBSD)

TEST(APIntTest, i33_Count) {
APInt i33minus2(33, static_cast<uint64_t>(-2), true);
EXPECT_EQ(0u, i33minus2.countLeadingZeros());
EXPECT_EQ(32u, i33minus2.countLeadingOnes());
EXPECT_EQ(33u, i33minus2.getActiveBits());
EXPECT_EQ(1u, i33minus2.countTrailingZeros());
EXPECT_EQ(32u, i33minus2.countPopulation());
EXPECT_EQ(-2, i33minus2.getSExtValue());
EXPECT_EQ(((uint64_t)-2)&((1ull<<33) -1), i33minus2.getZExtValue());
}

#endif

Given that we are long past gcc 4.2, any chance someone with FreeBSD could check this now works and remove the XFAIL?

Thanks very much
Pete

Hi Pete,

I tested this on recent FreeBSD 11.0, and indeed the test is now succeeding just fine, as the system compiler is now clang 3.8.0.

Let’s just drop the || !defined(FreeBSD) part. Btw, any idea what the defined(llvm) part is supposed to accomplish?

-Dimitry

It was added in the same commit, and given the comment above I think
it's probably so the test still runs on FreeBSD if Clang is
self-hosting.

Tim.

Let's just drop the || !defined(__FreeBSD__) part. Btw, any idea what the
defined(__llvm__) part is supposed to accomplish?

It was added in the same commit, and given the comment above I think
it's probably so the test still runs on FreeBSD if Clang is
self-hosting.

Yeah, thats the way I read it too. So this is really just trying to single out gcc 4.2.1 on FreeBSD as the illegal target.

Thanks for running this Dimitry. I appreciate it.

Can you commit the removal of #if or would you prefer me to?

Thanks again,
Pete

Removed in r276730.

-Dimitry