public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "sandra at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/100917] Bind(c): errors handling long double real Date: Sun, 11 Jul 2021 20:55:17 +0000 [thread overview] Message-ID: <bug-100917-4-q0QrkipxzT@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-100917-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100917 --- Comment #6 from sandra at gcc dot gnu.org --- I've been thinking some more about this issue. It seems to me that a "proper" solution is either (1) Add a kind field to the GFC descriptor or (2) Do away with GFC descriptors and use the C descriptor layout and encodings everywhere. Both of these break ABI. (2) is more work to implement but more maintainable long term, also more efficient at runtime. To be more specific about the problem here.... on x86 targets, real(kind=10) in Fortran or long double in C is an 80-bit representation. On 32-bit processors it has size 12 but on 64-bit processors it needs to be padded to 16 bytes. Thus, if we only have elem_len=16 in the descriptor, we can't tell if it is the 80-bit representation or the true 128-bit _float128 representation when that is also available. For a workaround that does not change the ABI, the best ideas I've had are either mapping CFI_type_long_double and CFI_type_float128 to the same value on targets where the two types both have size 16, or one of them to a negative value to indicate it's not interoperable on that target. In practice it's probably rare for user code to have to use the typecode to distinguish between floating-point formats -- you define your C function to accept the type of arguments you intend to pass into it. Anyway, a workaround for the floating-point stuff still leaves the character size vs character length problem unaccounted for.
next prev parent reply other threads:[~2021-07-11 20:55 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-04 20:05 [Bug fortran/100917] New: " jrfsousa at gcc dot gnu.org 2021-06-04 20:05 ` [Bug fortran/100917] " jrfsousa at gcc dot gnu.org 2021-06-13 18:41 ` jrfsousa at gcc dot gnu.org 2021-06-13 18:42 ` jrfsousa at gcc dot gnu.org 2021-06-26 23:35 ` sandra at gcc dot gnu.org 2021-06-29 3:35 ` sandra at gcc dot gnu.org 2021-07-11 20:55 ` sandra at gcc dot gnu.org [this message] 2021-09-02 23:42 ` cvs-commit at gcc dot gnu.org 2021-09-03 0:04 ` sandra at gcc dot gnu.org 2021-10-22 16:33 ` sandra at gcc dot gnu.org
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=bug-100917-4-q0QrkipxzT@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe 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).