emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange problems with data-tests.el


From: Eli Zaretskii
Subject: Strange problems with data-tests.el
Date: Sun, 12 Aug 2018 21:37:18 +0300

The newly built master (including bignums and after removing misc)
passed src/data-tests.el for an unoptimized build and for an -O2
optimized build.  When I tried the -Og optimized build, it failed the
tests.  The reason for the failures seems to be that the following
expression yields nil, whereas the test expects it to yield t:

  (< 0.5 most-positive-fixnum (+ 1.0 most-positive-fixnum))

(This is a 32-bit build --with-wide-int, using GCC 7.3.0.)

I stepped with a debugger through arithcompare.  The values involved
aren't easy to display, and optimizations don't help, but after some
tinkering with "nexti" and "info float", it looks like the values of
f1 and f2 are loaded into FP registers when this line is executed:

          fneq = f1 != f2;

which correctly yields 'true' (as there's no loss of precision in both
values), but when we get to this line:

    case ARITH_LESS:
      test = fneq ? f1 < f2 : i1 < i2;

what I seem to see in the 2 FP registers is the same value(??), and in
any case 'test' comes out 'false'.  ("info address" at this point
tells me that both f1 and f2 are "complex DWARF expressions", so
perhaps what I see in the FP registers is not the real values.)

This all looks like a compiler bug, but the code looks too simple for
that, so perhaps it's some subtlety that only trips us in this
combination: 32-bit build with 64-bit EMACS_INT and some FP values in
80-bit extended-precision registers?

Rebuilding with -O2 makes the problem go away, but why should -Og
(whose optimizations are almost exactly -O1) fail to work here?

Any ideas for how to pursue this further?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]