This is the mail archive of the
mailing list for the GDB project.
[PATCH] Deal with GCC bug on 64-bit SPARC
- From: Mark Kettenis <kettenis at chello dot nl>
- To: gdb-patches at sources dot redhat dot com
- Date: Sat, 3 Jan 2004 21:46:31 +0100 (CET)
- Subject: [PATCH] Deal with GCC bug on 64-bit SPARC
GCC generates code that doesn't conform to the ABI. Fortunately, we
can deal with that lossage in GDB. Patch attached and committed.
from Mark Kettenis <email@example.com>
* sparc64-tdep.c (sparc64_store_floating_fields): If TYPE is a
structure that has a single `float' member, store it in %f1 in
addition to %f0.
RCS file: /cvs/src/src/gdb/sparc64-tdep.c,v
retrieving revision 1.5
diff -u -p -r1.5 sparc64-tdep.c
--- sparc64-tdep.c 3 Jan 2004 15:00:10 -0000 1.5
+++ sparc64-tdep.c 3 Jan 2004 20:44:44 -0000
@@ -668,6 +668,21 @@ sparc64_store_floating_fields (struct re
sparc64_store_floating_fields (regcache, subtype, valbuf,
+ /* GCC has an interesting bug. If TYPE is a structure that has
+ a single `float' member, GCC doesn't treat it as a structure
+ at all, but rather as an ordinary `float' argument. This
+ argument will be stored in %f1, as required by the psABI.
+ However, as a member of a structure the psABI requires it to
+ be stored in. To appease GCC, if a structure has only a
+ single `float' member, we store its value in %f1 too. */
+ if (TYPE_NFIELDS (type) == 1)
+ struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, 0));
+ if (sparc64_floating_p (subtype) && TYPE_LENGTH (subtype) == 4)
+ regcache_cooked_write (regcache, SPARC_F1_REGNUM, valbuf);