unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Maxime Devos <maximedevos@telenet.be>
Cc: 49659@debbugs.gnu.org
Subject: [bug#49659] [PATCH core-updates] gnu: guile: Fix failing tests on i686-linux.
Date: Tue, 20 Jul 2021 15:55:49 +0200	[thread overview]
Message-ID: <871r7tks2i.fsf@gnu.org> (raw)
In-Reply-To: <20210720112712.25905-1-maximedevos@telenet.be> (Maxime Devos's message of "Tue, 20 Jul 2021 13:27:12 +0200")

Hi!

Maxime Devos <maximedevos@telenet.be> skribis:

> i586-gnu might have the same issue.

Please add a “Fixes …” line.

> * gnu/packages/guile.scm
>   (guile-3.0)[arguments]<#:configure-flags>: Add
>   "-fexcess-precision=standard" to CFLAGS.

Nitpick: the first two lines can be joined.  :-)

>       (substitute-keyword-arguments (package-arguments guile-2.2)
>         ((#:configure-flags flags ''())
> -        (let ((flags `(cons "--enable-mini-gmp" ,flags)))
> +        ;; -fexcess-precision=standard is required when compiling for
> +        ;; i686-linux, otherwise "numbers.test" will fail.
> +        (let ((flags `(cons* "CFLAGS=-g -O2 -fexcess-precision=standard"
> +                              "--enable-mini-gmp" ,flags)))

Yay!  Questions:

  1. Should we make it conditional on
       (or (string-prefix? "i686-" %host-type)
           (string-prefix? "i586-" %host-type))
     ?  (I wonder why armhf-linux doesn’t have the same problem.)

  2. Is there any downside to compiling all of libguile with this flag?

  3. Do we have a clear explanation of why ‘-fexcess-precision=fast’
     (the default) would lead to failures in ‘numbers.test’?

I looked at the GCC manual (info "(gcc) Optimize Options") and at links
you provided earlier on IRC, but I can’t really explain how this would
lead those tests to fail: <https://issues.guix.gnu.org/49368>.

I added a ‘printf’ call in ‘scm_i_inexact_floor_divide’, which is where
it all happens:

--8<---------------cut here---------------start------------->8---
static void
scm_i_inexact_floor_divide (double x, double y, SCM *qp, SCM *rp)
{
  if (SCM_UNLIKELY (y == 0))
    scm_num_overflow (s_scm_floor_divide);  /* or return a NaN? */
  else
    {
      double q = floor (x / y);
      double r = x - q * y;
      printf ("%s x=%f y=%f x/y=%f floor(x/y)=%f q=%f r=%f\n", __func__,
	      x, y, x/y, floor (x/y), q, r);
      *qp = scm_i_from_double (q);
      *rp = scm_i_from_double (r);
    }
}
--8<---------------cut here---------------end--------------->8---

I get this:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (euclidean/ 130. (exact->inexact 10/7))
scm_i_inexact_floor_divide x=130.000000 y=1.428571 x/y=91.000000 floor(x/y)=90.000000 q=90.000000 r=1.428571
$1 = 90.0
$2 = 1.4285714285714257
--8<---------------cut here---------------end--------------->8---

So it’s really ‘floor’ that’s messing up somehow.

Perhaps we have to just accept it, use the flag, and be done with it,
but that’s frustrating.

Thoughts?

Ludo’.




  reply	other threads:[~2021-07-20 13:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20 11:27 [bug#49659] [PATCH core-updates] gnu: guile: Fix failing tests on i686-linux Maxime Devos
2021-07-20 13:55 ` Ludovic Courtès [this message]
2021-07-20 16:55   ` Maxime Devos
2021-07-20 20:51     ` Ludovic Courtès
2021-07-20 18:22   ` Efraim Flashner
2021-07-20 21:34 ` [bug#49659] [PATCH v2\ core-updates v2] " Maxime Devos
2021-07-21 13:49   ` bug#49659: [PATCH core-updates] " Ludovic Courtès
2021-07-21 14:50     ` [bug#49659] " Mathieu Othacehe
2021-07-23  9:07       ` Ludovic Courtès
2021-07-23  9:27         ` Maxime Devos
2021-07-25 23:52         ` Thiago Jung Bauermann via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871r7tks2i.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=49659@debbugs.gnu.org \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).