[m-rev.] for post-commit review: Cast uint literals to MR_Unsigned in C code.
Peter Wang
novalazy at gmail.com
Mon Apr 16 00:09:57 AEST 2018
compiler/c_util.m:
Write uints with a cast to `MR_Unsigned' so they have the intended
type.
---
compiler/c_util.m | 3 +++
1 file changed, 3 insertions(+)
diff --git a/compiler/c_util.m b/compiler/c_util.m
index ce44faed5..3761812f9 100644
--- a/compiler/c_util.m
+++ b/compiler/c_util.m
@@ -831,6 +831,9 @@ output_int_expr_cur_stream(N, !IO) :-
%
output_uint_expr(Stream, N, !IO) :-
+ % We need to cast to (MR_Unsigned) to ensure things like 1 << 32 work
+ % when `MR_Unsigned' is 64 bits but `unsigned int' is 32 bits.
+ io.write_string("(MR_Unsigned) ", !IO),
io.write_uint(Stream, N, !IO),
io.write_string(Stream, "U", !IO).
--
2.16.3
More information about the reviews
mailing list