[m-dev.] bug in type_info.c
Tyson Richard DOWD
trd at students.cs.mu.oz.au
Wed Feb 19 09:52:36 AEDT 1997
> Hi Tyson,
>
> Can you please review the following diff?
> Also, could you please add some more tests for type_info.c,
> including one that covers this case?
> I spotted this one only because gcc warned about it.
>
> runtime/type_info.c:
> Fix a bug where the return value from a recursive call to
> type_info() was ignored.
>
> Index: deep_copy.c
> ===================================================================
> RCS file: /home/staff/zs/imp/mercury/runtime/deep_copy.c,v
> retrieving revision 1.8
> diff -u -r1.8 deep_copy.c
> --- 1.8 1997/02/18 03:06:29
> +++ deep_copy.c 1997/02/18 15:33:44
> @@ -235,7 +235,8 @@
> /* note: we treat no_tag types just like equivalences */
>
> if ((Word) entry_value < TYPELAYOUT_MAX_VARINT) {
> - deep_copy(data, (Word *) type_info[(Word) entry_value],
> + new_data = deep_copy(data,
> + (Word *) type_info[(Word) entry_value],
> lower_limit, upper_limit);
> } else {
> new_type_info = make_type_info(type_info,
This is correct, however the code is still not right - the code below
doesn't check for no_tag types correctly.
This is a result of a double-maintenance problem. Oliver Hutchison
is working on a more general fix for this (because he uses the same
code twice in his changes, making it a quadruple maintenance problem).
Commit this for now, but we should soon have a better fix.
--
Tyson Dowd # "Most people's C code should be indented
# six feet downward and covered with
trd at cs.mu.oz.au # dirt."
http://www.cs.mu.oz.au/~trd # - Blair Houghton, on C code indentation
More information about the developers
mailing list