From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id D65A41F55B for ; Sat, 23 May 2020 17:51:45 +0000 (UTC) Received: from localhost ([::1]:34146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jcYJE-0007PQ-ON for normalperson@yhbt.net; Sat, 23 May 2020 13:51:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcYJ1-0007P5-VG for bug-gnulib@gnu.org; Sat, 23 May 2020 13:51:31 -0400 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::11]:12624) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcYIz-0003gy-Ld for bug-gnulib@gnu.org; Sat, 23 May 2020 13:51:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1590256283; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=zRNDn6KNdLu8lGrJ6Gt7+j9vl0oGWffTukh4RN7JOL4=; b=RhZo28GgtFA42KB0d8sSCahvsBIOHQjBG+iMTPjy4DtBZMRo1IRxqHKsELYGawOwW8 4JbMKmqWj7jUnv+klyOmoI/RWvGIvmeq3UYqP+fLLH7kDU7MUrgVAEV9Evx4Yfdbm7Xw D/LrrHWaOH/sd87MrJx7ro3oX9+DgZrgBE7VmTNkaYA3wkbDKMkTrhMr+pUbGHNGXL6i J/bZdf2eOqgDoyLHCJ1Z1cfiBozK64tA6UsZfT5wNkc/bjD4a6ZjT9LQGQvpEUhMPcFJ Wjt0H4EsQd2aEjFXZfYcKBIAoVaW1Zq1luPJJVDs1QMD+q3s7l9W+ZClhYEX3L4MnGxm J5Cg== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOH6fzxfs=" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 46.7.0 DYNA|AUTH) with ESMTPSA id x0bd30w4NHpMQ1g (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Sat, 23 May 2020 19:51:22 +0200 (CEST) From: Bruno Haible To: Tim =?ISO-8859-1?Q?R=FChsen?= Subject: Fix exponentl.m4 test Date: Sat, 23 May 2020 19:51:22 +0200 Message-ID: <5683048.9VKiI42e5V@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-177-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: References: <10131976.Az27LhXeeQ@omega> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" Received-SPF: none client-ip=2a01:238:20a:202:5300::11; envelope-from=bruno@clisp.org; helo=mo6-p00-ob.smtp.rzone.de X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bug-gnulib@gnu.org Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Tim R=FChsen wrote: > Attached is the config.log and config.cache for > - gcc-9 with unset CFLAGS (*.gcc-9) > - clang-9 with unset CFLAGS (*.clang-9) > - gcc-10 with unset CFLAGS (*.gcc-10) > - clang-10 with unset CFLAGS (*.clang-10) >=20 > And the same set with -fsanitize... (*.sanitize). Thanks, that's much more useful. The first interesting finding is this difference between config.cache.gcc-9 and config.cache.gcc-10: =2Dgl_cv_cc_long_double_expbit0=3D${gl_cv_cc_long_double_expbit0=3D'word 2 = bit 0'} +gl_cv_cc_long_double_expbit0=3D${gl_cv_cc_long_double_expbit0=3Dunknown} Indeed, with GCC 10 I see: checking where to find the exponent in a 'long double'... unknown I see it also with older versions of GCC, with "-O2". What happens is that on x86_64, 'long double' is the 80-bit "extended doubl= e" format, which needs 3 'unsigned int' values. But sizeof (long double) =3D 16 [whereas on x86, sizeof (long double) =3D 12]. So, in the test, NWORDS =3D = 4. But when optimizing, the compiler apparently copies only 3 words, not 4 wor= ds, when reading or writing a parameter of type 'long double'. I would like to avoid hard coding the particular representation (since possible some other compilers will use 'float128' as 'long double'). This patch brings back checking where to find the exponent in a 'long double'... word 2 bit 0 2020-05-23 Bruno Haible isnanl, isnanl-nolibm: Make a test work better with "gcc -O2" on x86_64. * m4/exponentl.m4 (gl_LONG_DOUBLE_EXPONENT_LOCATION): Pass the 'long double' values by reference, with values taken from a statically allocated array. diff --git a/m4/exponentl.m4 b/m4/exponentl.m4 index b33b3bf..0a35c11 100644 =2D-- a/m4/exponentl.m4 +++ b/m4/exponentl.m4 @@ -1,4 +1,4 @@ =2D# exponentl.m4 serial 4 +# exponentl.m4 serial 5 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -22,14 +22,14 @@ typedef union { long double value; unsigned int word[NW= ORDS]; } memory_long_double; static unsigned int ored_words[NWORDS]; static unsigned int anded_words[NWORDS]; =2Dstatic void add_to_ored_words (long double x) +static void add_to_ored_words (long double *x) { memory_long_double m; size_t i; /* Clear it first, in case sizeof (long double) < sizeof (memory_long_double). */ memset (&m, 0, sizeof (memory_long_double)); =2D m.value =3D x; + m.value =3D *x; for (i =3D 0; i < NWORDS; i++) { ored_words[i] |=3D m.word[i]; @@ -38,17 +38,15 @@ static void add_to_ored_words (long double x) } int main () { + static long double samples[5] =3D { 0.25L, 0.5L, 1.0L, 2.0L, 4.0L }; size_t j; FILE *fp =3D fopen ("conftest.out", "w"); if (fp =3D=3D NULL) return 1; for (j =3D 0; j < NWORDS; j++) anded_words[j] =3D ~ (unsigned int) 0; =2D add_to_ored_words (0.25L); =2D add_to_ored_words (0.5L); =2D add_to_ored_words (1.0L); =2D add_to_ored_words (2.0L); =2D add_to_ored_words (4.0L); + for (j =3D 0; j < 5; j++) + add_to_ored_words (&samples[j]); /* Remove bits that are common (e.g. if representation of the first mant= issa bit is explicit). */ for (j =3D 0; j < NWORDS; j++)