public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: Gerald Pfeifer <gerald@pfeifer.com>
Cc: Sandra Loosemore <sandra@codesourcery.com>,
	Andreas Tobler <andreast@FreeBSD.org>, <fortran@gcc.gnu.org>,
	<gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, Fortran] Revert to non-multilib-specific ISO_Fortran_binding.h
Date: Tue, 14 Sep 2021 17:16:22 +0200	[thread overview]
Message-ID: <3eef3e69-4f10-62f8-a883-1c8ea27f810d@codesourcery.com> (raw)
In-Reply-To: <2de2f2b0-d221-acc1-79d4-554ee480c62@pfeifer.com>

Hi Gerald,

I note:

On 13.09.21 17:56, Gerald Pfeifer wrote:
> % egrep -r '#define.*LDBL_(MANT_DIG|MIN_EXP|MAX_EXP)'/usr/include/
> /usr/include/x86/float.h:#define LDBL_MANT_DIG  64
> /usr/include/x86/float.h:#define LDBL_MIN_EXP   (-16381)
> /usr/include/x86/float.h:#define LDBL_MAX_EXP   16384
>
> This looks like it matches existing Linux case already in place?
On 14.09.21 16:50, Gerald Pfeifer wrote:
> On Mon, 13 Sep 2021, Tobias Burnus wrote:
>> Can you run 'echo | cpp -E -g3|grep DBL' to (or in the build dir: echo |
>> ./gcc/cc1 -E -g3 -dD|grep DBL) to check what's the output?
> Thank you, Tobias, and I'm just testing the proposed patch, but still
> wanted to follow up on your question:
>
>    % echo | ./gcc/cc1 -E -g3 -dD | grep DBL
>    #define __DBL_MANT_DIG__ 53
>    #define __DBL_MIN_EXP__ (-1021)
>    #define __DBL_MAX_EXP__ 1024
>
>    #define __LDBL_MANT_DIG__ 53
>    #define __LDBL_MIN_EXP__ (-16381)
>    #define __LDBL_MAX_EXP__ 16384

I note that LDBL_MANT_DIG is 53 as for "double" – while Linux
and your header file has 64. On the other hand, MIN/MAX_EXP for
"long double" are larger than "double" – and match the values
from Linux and the size in your header file.

Thus, the first question is: why does DBL_MANT_DIG differ (64 vs. 53)?

And, related, does the following make sense and fixes the issue?

--- a/libgfortran/ISO_Fortran_binding.h
+++ b/libgfortran/ISO_Fortran_binding.h
@@ -228,5 +228,5 @@ extern int CFI_setpointer (CFI_cdesc_t *, CFI_cdesc_t *, const CFI_index_t []);

  /* This is the 80-bit encoding on x86; Fortran assigns it kind 10.  */
-#elif (LDBL_MANT_DIG == 64 \
+#elif ((LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 53) \
         && LDBL_MIN_EXP == -16381 \
         && LDBL_MAX_EXP == 16384)

Tobias

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

  reply	other threads:[~2021-09-14 15:16 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19  2:57 Sandra Loosemore
2021-09-03  2:05 ` PING " Sandra Loosemore
2021-09-06 19:29 ` Tobias Burnus
2021-09-10 15:39 ` Andreas Schwab
2021-09-13  7:51   ` Tobias Burnus
2021-09-13 15:56 ` Gerald Pfeifer
2021-09-13 16:32   ` Tobias Burnus
2021-09-13 16:51     ` Jakub Jelinek
2021-09-13 16:59       ` Sandra Loosemore
2021-09-13 17:07         ` Tobias Burnus
2021-09-13 17:20           ` Jakub Jelinek
2021-09-14  3:39           ` Sandra Loosemore
2021-09-14  7:39             ` Tobias Burnus
2021-09-14 16:34             ` Gerald Pfeifer
2021-09-14 14:50     ` Gerald Pfeifer
2021-09-14 15:16       ` Tobias Burnus [this message]
2021-09-14 15:17       ` Andreas Schwab
2021-09-14 15:23         ` Jakub Jelinek
2021-09-14 15:30           ` Andreas Schwab
2021-09-15  1:05             ` Joseph Myers
2021-09-14 19:27           ` Gerald Pfeifer
2021-09-17  6:03             ` Gerald Pfeifer
2021-09-17 14:10               ` [committed] Fortran: Prefer GCC internal macros to float.h in ISO_Fortran_binding.h (was: [PATCH, Fortran] Revert to non-multilib-specific ISO_Fortran_binding.h) Tobias Burnus
2021-09-18  4:51                 ` Gerald Pfeifer
2021-09-13 17:39   ` [PATCH, Fortran] Revert to non-multilib-specific ISO_Fortran_binding.h Andreas Schwab
2021-09-13 18:07   ` Jakub Jelinek

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

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

  git send-email \
    --in-reply-to=3eef3e69-4f10-62f8-a883-1c8ea27f810d@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=andreast@FreeBSD.org \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gerald@pfeifer.com \
    --cc=sandra@codesourcery.com \
    /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.
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).