tests/mpq/t-get_d.c failure on m68k-linux
aldyh at redhat.com
Fri Feb 1 14:58:53 CET 2013
[reposting to the correct mailing list]
[Disclaimer: I am not a 68k guru. Well, for that matter neither am I an
Mikael reported a bug while running the GMP testsuite on GCC's bugzilla:
The problem here stems from the equality comparison in check_random() in
if (d != d2)
printf ("ERROR (check_random test %d): bad mpq_set_d...
As I discuss in the PR, d and d2 reside in %fp2 and %fp3. The
comparison in the FPRs happen in extended precision, but FP moves
to/from memory happen in double precision format, so some precision is
lost if floating point variables get shuffled between FPRs and memory.
This means that EQ/NE comparisons with FP values on 68k are extremely
problematic because the programmer has no way of knowing if the values
are in memory or in the FP registers. For example, the compiler may
have spilled an FPR to memory and read it back, thus losing some
precision, causing the equality to fail.
I suggest running the testcase (and possibly all of GMP) with
-ffloat-store on m68k.
This is a longstanding and known issue on architectures where the
precision of the FPRs and their representation in memory differ. See
the PR notes above, and also:
The original bug was reported on gmp-5.0.5 although I see that gmp-5.1.0
also has the EQ/NE comparison.
I hope this helps.
More information about the gmp-bugs