projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b6442e8
)
In stgReallocForGMP, we need to copy min(old_size,new_size)
author
Ian Lynagh
<igloo@earth.li>
Thu, 11 Sep 2008 12:08:06 +0000
(12:08 +0000)
committer
Ian Lynagh
<igloo@earth.li>
Thu, 11 Sep 2008 12:08:06 +0000
(12:08 +0000)
We used to always copy old_size
rts/sm/Storage.c
patch
|
blob
|
history
diff --git
a/rts/sm/Storage.c
b/rts/sm/Storage.c
index
a6134c6
..
8d237c1
100644
(file)
--- a/
rts/sm/Storage.c
+++ b/
rts/sm/Storage.c
@@
-926,12
+926,14
@@
stgAllocForGMP (size_t size_in_bytes)
static void *
stgReallocForGMP (void *ptr, size_t old_size, size_t new_size)
{
+ size_t min_size;
void *new_stuff_ptr = stgAllocForGMP(new_size);
nat i = 0;
char *p = (char *) ptr;
char *q = (char *) new_stuff_ptr;
- for (; i < old_size; i++, p++, q++) {
+ min_size = old_size < new_size ? old_size : new_size;
+ for (; i < min_size; i++, p++, q++) {
*q = *p;
}