~ chicken-core (chicken-5) bb36b1d1516b485d7ae522e39fdf9b56e7a70d4f
commit bb36b1d1516b485d7ae522e39fdf9b56e7a70d4f
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Fri Jan 13 18:47:48 2012 +0100
Commit: Peter Bex <peter.bex@xs4all.nl>
CommitDate: Tue Feb 21 19:52:58 2012 +0100
Ensure character is extended to full word-length. This doesn't make much of a difference semantically, but avoids a warning with valgrind(1) on 64-bit platforms: gcc stores a character argument using a 32-bit "mov" instruction into the stackframe, keeping the upper half uninitialized.
The argument value of "C_make_character" is cast to "C_uword", which
was once suggested by Joerg Wittenberger and Alan Post to ensure that
the default sign of characters (which may be different, depending on
the compiler and platform) does not influence any character
operations.
Signed-off-by: Peter Bex <peter.bex@xs4all.nl>
diff --git a/chicken.h b/chicken.h
index fdf4b72c..58d75332 100644
--- a/chicken.h
+++ b/chicken.h
@@ -955,7 +955,7 @@ extern double trunc(double);
#define C_demand_2(n) (((C_word *)C_fromspace_top + (n)) < (C_word *)C_fromspace_limit)
#define C_fix(n) (((C_word)(n) << C_FIXNUM_SHIFT) | C_FIXNUM_BIT)
#define C_unfix(x) ((x) >> C_FIXNUM_SHIFT)
-#define C_make_character(c) ((((c) & C_CHAR_BIT_MASK) << C_CHAR_SHIFT) | C_CHARACTER_BITS)
+#define C_make_character(c) (((((C_uword)(c)) & C_CHAR_BIT_MASK) << C_CHAR_SHIFT) | C_CHARACTER_BITS)
#define C_character_code(x) (((C_word)(x) >> C_CHAR_SHIFT) & C_CHAR_BIT_MASK)
#define C_flonum_magnitude(x) (*((double *)(((C_SCHEME_BLOCK *)(x))->data)))
#define C_c_string(x) ((C_char *)(((C_SCHEME_BLOCK *)(x))->data))
Trap