]> gcc.gnu.org Git - gcc.git/commitdiff
natThrowable.cc (printRawStackTrace): Copy the stackTrace buffer to a correctly align...
authorAndrew Haley <aph@redhat.com>
Wed, 14 Mar 2001 15:49:06 +0000 (15:49 +0000)
committerAndrew Haley <aph@gcc.gnu.org>
Wed, 14 Mar 2001 15:49:06 +0000 (15:49 +0000)
2001-03-01  Andrew Haley  <aph@redhat.com>

        * java/lang/natThrowable.cc (printRawStackTrace): Copy the
        stackTrace buffer to a correctly aligned pointer array.

From-SVN: r40456

libjava/ChangeLog
libjava/java/lang/natThrowable.cc

index 44a3bd830af43beb0c2226ca306621b0dd3f3a7c..218639e748fbad19dcf5eb642b6ad162c4dafd0c 100644 (file)
@@ -1,3 +1,8 @@
+2001-03-01  Andrew Haley  <aph@redhat.com>
+
+       * java/lang/natThrowable.cc (printRawStackTrace): Copy the
+       stackTrace buffer to a correctly aligned pointer array.
 2001-03-12  Bryce McKinlay  <bryce@albatross.co.nz>
 
        * java/lang/Runtime.java (_exit): Declare new package-private native.
index dab3ba6387a5f707ca7fdfc5f8c22c1ccf68c6d7..6080ea3239968ac4d264c6841832970f74d9e6bc 100644 (file)
@@ -65,7 +65,7 @@ java::lang::Throwable::fillInStackTrace (void)
 
   if (n > 0)
     {
-      // ???  Might this cause a problem if the byte array isn't aligned?
+      // We copy the array below to deal with alignment issues.
       stackTrace = JvNewByteArray (n * sizeof p[0]);
       memcpy (elements (stackTrace), p+1, (n * sizeof p[0]));
     }
@@ -83,8 +83,9 @@ java::lang::Throwable::printRawStackTrace (java::io::PrintWriter *wr)
   if (!stackTrace)
     return;
 
-  void **p = (void **)elements (stackTrace);
-  int depth = stackTrace->length / sizeof p[0];
+  int depth = stackTrace->length / sizeof (void *);
+  void *p[depth];
+  memcpy (p, elements (stackTrace), sizeof p);
 
   _Jv_name_finder finder (_Jv_ThisExecutable ());
 
This page took 0.069564 seconds and 5 git commands to generate.