[m-dev.] diff: add type cast to argument of MR_body()
David Overton
dmo at cs.mu.OZ.AU
Tue Jul 13 15:04:39 AEST 1999
Estimated hours taken: 1
runtime/mercury_tags.h:
In the definition of MR_body(), cast the first argument to
type Word before doing the tag subtraction.
This is necessary for code such as:
r3 = MR_const_field(MR_mktag(1), MR_mkword(MR_mktag(1),
&mercury_const_46), (Integer) 0);
(which is produced by value numbering). MR_mkword casts its
result to type (Word *) which means that MR_body, called from
within MR_const_field, was doing pointer arithmetic on it and
thus failing to remove the tag properly.
Index: mercury_tags.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_tags.h,v
retrieving revision 1.5
diff -u -r1.5 mercury_tags.h
--- mercury_tags.h 1999/04/30 04:25:42 1.5
+++ mercury_tags.h 1999/07/13 02:18:49
@@ -50,7 +50,7 @@
#define MR_tag(w) ((w) & ((1 << TAGBITS) - 1))
#define MR_mkbody(i) ((i) << TAGBITS)
#define MR_unmkbody(w) ((Word) (w) >> TAGBITS)
-#define MR_body(w, t) ((w) - (t))
+#define MR_body(w, t) ((Word) (w) - (t))
#define MR_strip_tag(w) ((w) & (~(Word)0 << TAGBITS))
#endif /* ! HIGHTAGS */
--
David Overton Department of Computer Science & Software Engineering
MEngSc Student The University of Melbourne, Australia
+61 3 9344 9159 http://www.cs.mu.oz.au/~dmo
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list