This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix complex doube/long double return of i386


Just like on amd64, returning complex numbers wasn't handled.  The
official System V ABI doesn't mention complex numbers, but returning
them as if they are a struct (just like the large decimal floating
point types) is the only sensible thing to do.

Committed.

2012-10-24  Mark Kettenis  <kettenis@gnu.org>

	PR gdb/12783
	* i386-tdep.c (i386_return_value): Handle complex double and long
	double.

Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.358
diff -u -p -r1.358 i386-tdep.c
--- i386-tdep.c	15 Oct 2012 20:37:39 -0000	1.358
+++ i386-tdep.c	24 Oct 2012 14:50:13 -0000
@@ -2630,6 +2630,9 @@ i386_return_value (struct gdbarch *gdbar
 	|| code == TYPE_CODE_UNION
 	|| code == TYPE_CODE_ARRAY)
        && !i386_reg_struct_return_p (gdbarch, type))
+      /* Complex double and long double uses the struct return covention.  */
+      || (code == TYPE_CODE_COMPLEX && TYPE_LENGTH (type) == 16)
+      || (code == TYPE_CODE_COMPLEX && TYPE_LENGTH (type) == 24)
       /* 128-bit decimal float uses the struct return convention.  */
       || (code == TYPE_CODE_DECFLOAT && TYPE_LENGTH (type) == 16))
     {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]