* [PATCH] Fix complex float handling for 64-bit SPARC
@ 2012-04-07 20:18 Mark Kettenis
2012-04-07 20:47 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Mark Kettenis @ 2012-04-07 20:18 UTC (permalink / raw)
To: davem; +Cc: gdb-patches
Hi Dave,
Looks like the 64-bit code you committed last year wasn't complete.
There is a missing sparc64_complex_float_p() check, which results in a
guarenteed assertion failure. The diff below fixes this and as a
bonus also makes complex return values work. Makes the complex float
tests in gdb.base/callfuncs.exp work with the OpenBSD system compiler
(GCC 4.2.1). As far as I can tell this matches what's documented in
the Sun Studio 12 Fortran Programming Guide.
ok?
2012-04-07 Mark Kettenis <kettenis@gnu.org>
* sparc64-tdep.c (sparc64_store_arguments): Fix handling of
complex floats, adjust some related comments and tighten a related
assertion.
(sparc64_extract_return_value): Handle complex floats.
Index: sparc64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc64-tdep.c,v
retrieving revision 1.57
diff -u -p -r1.57 sparc64-tdep.c
--- sparc64-tdep.c 4 Jan 2012 08:17:12 -0000 1.57
+++ sparc64-tdep.c 7 Apr 2012 20:12:08 -0000
@@ -785,7 +785,8 @@ sparc64_store_arguments (struct regcache
struct type *type = value_type (args[i]);
int len = TYPE_LENGTH (type);
- if (sparc64_structure_or_union_p (type))
+ if (sparc64_structure_or_union_p (type) ||
+ (sparc64_complex_floating_p (type) && len == 32))
{
/* Structure or Union arguments. */
if (len <= 16)
@@ -816,10 +817,9 @@ sparc64_store_arguments (struct regcache
num_elements++;
}
}
- else if (sparc64_floating_p (type))
+ else if (sparc64_floating_p (type) || sparc64_complex_floating_p (type))
{
/* Floating arguments. */
-
if (len == 16)
{
/* The psABI says that "Each quad-precision parameter
@@ -887,7 +887,8 @@ sparc64_store_arguments (struct regcache
int regnum = -1;
gdb_byte buf[16];
- if (sparc64_structure_or_union_p (type))
+ if (sparc64_structure_or_union_p (type) ||
+ (sparc64_complex_floating_p (type) && len == 32))
{
/* Structure or Union arguments. */
gdb_assert (len <= 16);
@@ -927,7 +928,7 @@ sparc64_store_arguments (struct regcache
/* The psABI says "Each single-precision parameter value
will be assigned to one extended word in the
parameter array, and right-justified within that
- word; the left half (even floatregister) is
+ word; the left half (even float register) is
undefined." Even though the psABI says that "the
left half is undefined", set it to zero here. */
memset (buf, 0, 4);
@@ -960,7 +961,7 @@ sparc64_store_arguments (struct regcache
}
else if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q8_REGNUM)
{
- gdb_assert (element < 6);
+ gdb_assert (element < 5);
regnum = SPARC_O0_REGNUM + element;
regcache_cooked_write (regcache, regnum, valbuf);
regcache_cooked_write (regcache, regnum + 1, valbuf + 8);
@@ -1034,7 +1035,7 @@ sparc64_extract_return_value (struct typ
sparc64_extract_floating_fields (regcache, type, buf, 0);
memcpy (valbuf, buf, len);
}
- else if (sparc64_floating_p (type))
+ else if (sparc64_floating_p (type) || sparc64_complex_floating_p (type))
{
/* Floating return values. */
for (i = 0; i < len / 4; i++)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Fix complex float handling for 64-bit SPARC
2012-04-07 20:18 [PATCH] Fix complex float handling for 64-bit SPARC Mark Kettenis
@ 2012-04-07 20:47 ` David Miller
2012-04-08 5:59 ` Mark Kettenis
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2012-04-07 20:47 UTC (permalink / raw)
To: mark.kettenis; +Cc: gdb-patches
From: Mark Kettenis <mark.kettenis@xs4all.nl>
Date: Sat, 7 Apr 2012 22:17:40 +0200 (CEST)
> Looks like the 64-bit code you committed last year wasn't complete.
> There is a missing sparc64_complex_float_p() check, which results in a
> guarenteed assertion failure. The diff below fixes this and as a
> bonus also makes complex return values work. Makes the complex float
> tests in gdb.base/callfuncs.exp work with the OpenBSD system compiler
> (GCC 4.2.1). As far as I can tell this matches what's documented in
> the Sun Studio 12 Fortran Programming Guide.
>
> ok?
Looks good to me, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix complex float handling for 64-bit SPARC
2012-04-07 20:47 ` David Miller
@ 2012-04-08 5:59 ` Mark Kettenis
0 siblings, 0 replies; 3+ messages in thread
From: Mark Kettenis @ 2012-04-08 5:59 UTC (permalink / raw)
To: davem; +Cc: gdb-patches
> Date: Sat, 07 Apr 2012 16:47:26 -0400 (EDT)
> From: David Miller <davem@davemloft.net>
>
> From: Mark Kettenis <mark.kettenis@xs4all.nl>
> Date: Sat, 7 Apr 2012 22:17:40 +0200 (CEST)
>
> > Looks like the 64-bit code you committed last year wasn't complete.
> > There is a missing sparc64_complex_float_p() check, which results in a
> > guarenteed assertion failure. The diff below fixes this and as a
> > bonus also makes complex return values work. Makes the complex float
> > tests in gdb.base/callfuncs.exp work with the OpenBSD system compiler
> > (GCC 4.2.1). As far as I can tell this matches what's documented in
> > the Sun Studio 12 Fortran Programming Guide.
> >
> > ok?
>
> Looks good to me, thanks.
Thanks,
Committed
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-08 5:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-07 20:18 [PATCH] Fix complex float handling for 64-bit SPARC Mark Kettenis
2012-04-07 20:47 ` David Miller
2012-04-08 5:59 ` Mark Kettenis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox