public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Fix crash in amd64-tdep.c
@ 2023-01-03 16:44 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-01-03 16:44 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=862ebb27bbe30768356776a10827dd1c0824d405

commit 862ebb27bbe30768356776a10827dd1c0824d405
Author: Tom Tromey <tromey@adacore.com>
Date:   Tue Sep 6 08:44:52 2022 -0600

    Fix crash in amd64-tdep.c
    
    amd64-tdep.c could crash when 'finish'ing from a function whose return
    type had variable length.  In this situation, the value will be passed
    by reference, and this patch avoids the crash.
    
    (Note that this does not fully fix the bug reported, but it does fix
    the crash, so it seems worthwhile to land independently.)

Diff:
---
 gdb/amd64-tdep.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index b8cd8188044..0f2dab8b479 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -666,7 +666,8 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class theclass[2])
 	loc_bitpos attributes, which will cause an assert to trigger within
 	the unaligned field check.  As classes with virtual bases are not
 	trivially copyable, checking that first avoids this problem.  */
-  if (type->length () > 16
+  if (TYPE_HAS_DYNAMIC_LENGTH (type)
+      || type->length () > 16
       || !language_pass_by_reference (type).trivially_copyable
       || amd64_has_unaligned_fields (type))
     {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-03 16:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-03 16:44 [binutils-gdb] Fix crash in amd64-tdep.c Tom Tromey

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).