all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Strange problems with data-tests.el
@ 2018-08-12 18:37 Eli Zaretskii
  2018-08-12 22:43 ` Paul Eggert
  2018-08-13 10:06 ` Pip Cet
  0 siblings, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2018-08-12 18:37 UTC (permalink / raw)
  To: emacs-devel

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?



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-08-13 17:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-12 18:37 Strange problems with data-tests.el Eli Zaretskii
2018-08-12 22:43 ` Paul Eggert
2018-08-13 15:05   ` Eli Zaretskii
2018-08-13 16:24     ` Paul Eggert
2018-08-13 16:49       ` Eli Zaretskii
2018-08-13 17:02         ` Paul Eggert
2018-08-13 10:06 ` Pip Cet
2018-08-13 14:44   ` Eli Zaretskii
2018-08-13 14:58     ` Pip Cet
2018-08-13 16:43       ` Paul Eggert

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.