Fix passing double float complex arguments in sparc64.
authorJose E. Marchesi <jose.marchesi@oracle.com>
Tue, 11 Feb 2014 12:27:20 +0000 (04:27 -0800)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Tue, 11 Feb 2014 12:27:20 +0000 (04:27 -0800)
Double float complex objects are not 16-byte aligned in either
gcc or solaris studio.  This patch makes gdb to not align double
float complex arguments in the dummy frame when calling a
function.

2014-02-11  Jose E. Marchesi  <jose.marchesi@oracle.com>

        * sparc64-tdep.c (sparc64_store_arguments): Do not align complex
        double float arguments to 16-byte in the argument slots.

gdb/ChangeLog
gdb/sparc64-tdep.c

index 435a57069788ec7471f00746d198f586fa1cbff1..b2cd4513dcb5375acf99da50e0081b1e12e5599e 100644 (file)
@@ -1,3 +1,8 @@
+2014-02-11  Jose E. Marchesi  <jose.marchesi@oracle.com>
+
+        * sparc64-tdep.c (sparc64_store_arguments): Do not align complex
+        double float arguments to 16-byte in the argument slots.
+
 2014-02-11  Doug Evans  <xdje42@gmail.com>
 
        * configure.ac: Don't crash if pkg-config is not found and guile
index 9e4db3af961c9d10a9b0a11482396ed550dc9660..5d325606d4052a8af21fbfc1e837757e96a077e0 100644 (file)
@@ -831,7 +831,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
                  quad-aligned, and thus a hole might be introduced
                  into the parameter array to force alignment."  Skip
                  an element if necessary.  */
-             if (num_elements % 2)
+             if ((num_elements % 2) && sparc64_16_byte_align_p (type))
                num_elements++;
            }
          else
@@ -890,7 +890,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
       if (sparc64_structure_or_union_p (type)
          || (sparc64_complex_floating_p (type) && len == 32))
        {
-         /* Structure or Union arguments.  */
+         /* Structure, Union or long double Complex arguments.  */
          gdb_assert (len <= 16);
          memset (buf, 0, sizeof (buf));
          valbuf = memcpy (buf, valbuf, len);
@@ -908,7 +908,25 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
          if (element < 16)
            sparc64_store_floating_fields (regcache, type, valbuf, element, 0);
        }
-      else if (sparc64_floating_p (type) || sparc64_complex_floating_p (type))
+      else if (sparc64_complex_floating_p (type))
+       {
+         /* Float Complex or double Complex arguments.  */
+         if (element < 16)
+           {
+             regnum = SPARC64_D0_REGNUM + element;
+
+             if (len == 16)
+               {
+                 if (regnum < SPARC64_D30_REGNUM)
+                   regcache_cooked_write (regcache, regnum + 1, valbuf + 8);
+                 if (regnum < SPARC64_D10_REGNUM)
+                   regcache_cooked_write (regcache,
+                                          SPARC_O0_REGNUM + element + 1,
+                                          valbuf + 8);
+               }
+           }
+       }
+      else if (sparc64_floating_p (type))
        {
          /* Floating arguments.  */
          if (len == 16)
This page took 0.026922 seconds and 4 git commands to generate.