Hi Yuao,

Yuao Ma wrote:
>//but the testcases don't seem to be conditionalized on this. Would the
>//new tests fail if gcc is built against an insufficiently recent version
>//of mpfr,
The test case is indeed conditionalized, though in a different manner than you might expect. The condition depends on the version of MPFR we're using, and unfortunately, I haven't found a predefined macro that indicates which MPFR
version GCC is linked against.

I think there is a detour way: The 'print_version' function (toplev.cc) prints the MPFR version, but only when not printing to stderr.


Thus, I get the desired output with:


gcc -S -fverbose-asm -o - -x c - < /dev/null


[I think the /dev/null is not quite portable; possibly a pipe ("echo |...") or an empty file is more portable.]


The output contains here "... MPFR version 4.2.2 ..."


Thus, you could wrap this into an effective target check, similar to the others in gcc/testsuite/lib/target-supports.exp + then use a '{ target ... }' in the test case.


My current approach uses `__builtin_constant_p(acospi(0.5))`. If we're using a newer MPFR version, acospi will be constant-folded, causing the condition to evaluate to true and enabling the rest of the test. Otherwise, the condition
will be false, and the entire test case will be omitted.

... which might be well sufficient. But if so, I think it deserves a comment in the testcase because it is not obvious at a glance.


Tobias

Reply via email to