From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCHv2] gdb/fortran: Use floatformats_ia64_quad for fortran 16-byte floats
Date: Tue, 21 May 2019 22:56:00 -0000 [thread overview]
Message-ID: <20190521225559.GH2568@embecosm.com> (raw)
In-Reply-To: <87pnobef3p.fsf@tromey.com>
* Tom Tromey <tromey@adacore.com> [2019-05-21 16:18:18 -0400]:
> >>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:
>
> Andrew> Would you like me to push a fix, or do you want to do it?
>
> Go for it.
I pushed the below.
Thanks,
Andrew
---
commit dc42e902cc54af2b7e7b54a1171d562f867342d5
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date: Tue May 21 22:14:05 2019 +0100
gdb/fortran: Handle gdbarch_floatformat_for_type returning nullptr
In this commit:
commit 34d11c682fd96c7dbe3ebd6cd9033e65d51ec7a3
Date: Fri May 3 15:23:55 2019 +0100
gdb/fortran: Use floatformats_ia64_quad for fortran 16-byte floats
GDB was changed such that the Fortran's 16-byte float format was
obtained by calling gdbarch_floatformat_for_type instead of just using
gdbarch_long_double_format as it was before.
The problem with this default_floatformat_for_type can return NULL in
some cases, and the code introduced in 34d11c682f didn't consider
this.
This commit introduces several alternative strategies for finding a
suitable 16-byte floating point type. First GDB calls
gdbarch_floatformat_for_type (this was what 34d11c682f added), if this
returns null GDB will use gdbarch_long_double_format if it is the
correct size (this was the format used before 34d11c682f). Finally,
if neither of the above provides a suitable type then GDB will create
a new dummy type.
This final dummy type is unlikely to provide an correct debug
experience as far as examining the 16-byte floats, but it should
prevent GDB crashing.
gdb/ChangeLog:
PR gdb/18644:
* f-lang.c (build_fortran_types): Handle the case where
gdbarch_floatformat_for_type returns a nullptr.
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 5855c68b38c..e612eeda7f7 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -728,8 +728,16 @@ build_fortran_types (struct gdbarch *gdbarch)
= arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
"real*8", gdbarch_double_format (gdbarch));
auto fmt = gdbarch_floatformat_for_type (gdbarch, "real(kind=16)", 128);
- builtin_f_type->builtin_real_s16
- = arch_float_type (gdbarch, 128, "real*16", fmt);
+ if (fmt != nullptr)
+ builtin_f_type->builtin_real_s16
+ = arch_float_type (gdbarch, 128, "real*16", fmt);
+ else if (gdbarch_long_double_bit (gdbarch) == 128)
+ builtin_f_type->builtin_real_s16
+ = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
+ "real*16", gdbarch_long_double_format (gdbarch));
+ else
+ builtin_f_type->builtin_real_s16
+ = arch_type (gdbarch, TYPE_CODE_ERROR, 128, "real*16");
builtin_f_type->builtin_complex_s8
= arch_complex_type (gdbarch, "complex*8",
next prev parent reply other threads:[~2019-05-21 22:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-04 12:17 [PATCH] " Andrew Burgess
2019-05-16 16:01 ` [PATCHv2] " Andrew Burgess
2019-05-18 8:54 ` Andrew Burgess
2019-05-21 16:06 ` Tom Tromey
2019-05-21 16:53 ` Andrew Burgess
2019-05-21 17:05 ` Tom Tromey
2019-05-21 20:10 ` Andrew Burgess
2019-05-21 20:18 ` Tom Tromey
2019-05-21 22:56 ` Andrew Burgess [this message]
2019-05-22 16:56 ` Tom Tromey
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=20190521225559.GH2568@embecosm.com \
--to=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@adacore.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