List:Commits« Previous MessageNext Message »
From:Jonathan Perkin Date:April 28 2008 11:29am
Subject:bk commit into 6.0 tree (jperkin:1.2625) BUG#36320
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of jperkin.  When jperkin does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-04-28 11:29:17+02:00, jperkin@stripped +1 -0
  dtoa.c:
    Pull in patch from bug#36320 to fix 64bit
    architectures with strict alignment rules.

  strings/dtoa.c@stripped, 2008-04-28 11:23:25+02:00, jperkin@stripped +7 -4
    Pull in patch from bug#36320 to fix 64bit
    architectures with strict alignment rules.

diff -Nrup a/strings/dtoa.c b/strings/dtoa.c
--- a/strings/dtoa.c	2008-01-08 08:33:02 +01:00
+++ b/strings/dtoa.c	2008-04-28 11:23:25 +02:00
@@ -648,7 +648,9 @@ typedef struct Stack_alloc
 
 /*
   Try to allocate object on stack, and resort to malloc if all
-  stack memory is used.
+  stack memory is used. Ensure allocated objects to be aligned by the pointer
+  size in order to not break the alignment rules when storing a pointer to a
+  Bigint.
 */
 
 static Bigint *Balloc(int k, Stack_alloc *alloc)
@@ -664,7 +666,7 @@ static Bigint *Balloc(int k, Stack_alloc
     int x, len;
 
     x= 1 << k;
-    len= sizeof(Bigint) + x * sizeof(ULong);
+    len= MY_ALIGN(sizeof(Bigint) + x * sizeof(ULong), SIZEOF_CHARP);
 
     if (alloc->free + len <= alloc->end)
     {
@@ -709,13 +711,14 @@ static void Bfree(Bigint *v, Stack_alloc
 /*
   This is to place return value of dtoa in: tries to use stack
   as well, but passes by free lists management and just aligns len by
-  sizeof(ULong).
+  the pointer size in order to not break the alignment rules when storing a
+  pointer to a Bigint.
 */
 
 static char *dtoa_alloc(int i, Stack_alloc *alloc)
 {
   char *rv;
-  int aligned_size= (i + sizeof(ULong) - 1) / sizeof(ULong) * sizeof(ULong);
+  int aligned_size= MY_ALIGN(i, SIZEOF_CHARP);
   if (alloc->free + aligned_size <= alloc->end)
   {
     rv= alloc->free;
Thread
bk commit into 6.0 tree (jperkin:1.2625) BUG#36320Jonathan Perkin28 Apr 2008