public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: "Willgerodt, Felix via Gdb-patches" <gdb-patches@sourceware.org>
Cc: Tom Tromey <tom@tromey.com>,
	 "Willgerodt, Felix" <felix.willgerodt@intel.com>
Subject: Re: [PATCH 1/1] gdb, fortran: Fix quad floating-point type for ifort compiler.
Date: Fri, 24 Feb 2023 07:11:01 -0700	[thread overview]
Message-ID: <87wn47i26i.fsf@tromey.com> (raw)
In-Reply-To: <MN2PR11MB45666F618FA971DCB5EFF2408EA49@MN2PR11MB4566.namprd11.prod.outlook.com> (Felix via Gdb-patches Willgerodt's message of "Mon, 20 Feb 2023 09:17:47 +0000")

> When examining memory for this Fortran test, I see 128-bit values in
> binary128 format, so I assume that this is just a software/compiler feature. 
> There is also decimal128 support in e.g. gcc.  I tried it only briefly,
> we don't end up in i386_floatformat_for_type for those types, but
> GDB prints them just fine.  I assume as they are marked as
> DW_ATE_decimal_float instead of DW_ATE_float, but I didn't look into 
> it in detail.

> I am not aware of any other float types that exist with this length.

I wonder, then, if this patch would work?
This way we would not have to curate a list of names.

Tom

diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 476d17f1efd..57e50ffdd73 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -8277,20 +8277,8 @@ static const struct floatformat **
 i386_floatformat_for_type (struct gdbarch *gdbarch,
 			   const char *name, int len)
 {
-  if (len == 128 && name)
-    if (strcmp (name, "__float128") == 0
-	|| strcmp (name, "_Float128") == 0
-	|| strcmp (name, "complex _Float128") == 0
-	|| strcmp (name, "complex(kind=16)") == 0
-	|| strcmp (name, "COMPLEX(16)") == 0
-	|| strcmp (name, "complex*32") == 0
-	|| strcmp (name, "COMPLEX*32") == 0
-	|| strcmp (name, "quad complex") == 0
-	|| strcmp (name, "real(kind=16)") == 0
-	|| strcmp (name, "real*16") == 0
-	|| strcmp (name, "REAL*16") == 0
-	|| strcmp (name, "REAL(16)") == 0)
-      return floatformats_ieee_quad;
+  if (len == 128)
+    return floatformats_ieee_quad;
 
   return default_floatformat_for_type (gdbarch, name, len);
 }

  reply	other threads:[~2023-02-24 14:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14 11:00 Felix Willgerodt
2023-02-14 15:14 ` Tom Tromey
2023-02-15  9:05   ` Willgerodt, Felix
2023-02-15 16:52     ` Tom Tromey
2023-02-20  9:17       ` Willgerodt, Felix
2023-02-24 14:11         ` Tom Tromey [this message]
2023-02-28 10:21           ` Willgerodt, Felix

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=87wn47i26i.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=felix.willgerodt@intel.com \
    --cc=gdb-patches@sourceware.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: 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).