diff options
author | Damien Doligez <damien.doligez-inria.fr> | 2002-06-05 12:10:40 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 2002-06-05 12:10:40 +0000 |
commit | 069204e04f0064ca031054482944152bc37fb6ea (patch) | |
tree | e5f739bbad29cf4b6cc6a25c4618c8dceb5c6874 | |
parent | 2cea587bdf6602263c7c64cea582979186c6ca36 (diff) |
bug subtil obj_truncate
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4880 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | byterun/obj.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/byterun/obj.c b/byterun/obj.c index d7ce07f64..a167b799b 100644 --- a/byterun/obj.c +++ b/byterun/obj.c @@ -111,8 +111,7 @@ CAMLprim value obj_truncate (value v, value newsize) if (tag == Double_array_tag) new_wosize *= Double_wosize; /* PR#156 */ - if (new_wosize <= 0 || new_wosize > wosize) - invalid_argument ("Obj.truncate"); + if (new_wosize <= 0 || new_wosize > wosize) invalid_argument ("Obj.truncate"); if (new_wosize == wosize) return Val_unit; /* PR#61: since we're about to lose our references to the elements beyond new_wosize in v, erase them explicitly so that the GC @@ -125,8 +124,11 @@ CAMLprim value obj_truncate (value v, value newsize) #endif } } + /* We must use an odd tag for the header of the leftovers so it does not + look like a pointer because there may be some references to it in + ref_table. */ Field (v, new_wosize) = - Make_header (Wosize_whsize (wosize-new_wosize), 0, Caml_white); + Make_header (Wosize_whsize (wosize-new_wosize), 1, Caml_white); Hd_val (v) = Make_header (new_wosize, tag, color); return Val_unit; } |