Skip to content

Commit e02e453

Browse files
committed
Remove useless size check in Memory allocation
1 parent 946de33 commit e02e453

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/codegen.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4137,9 +4137,9 @@ static bool emit_builtin_call(jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f,
41374137
if (argv[2].constant) {
41384138
if (!jl_is_long(argv[2].constant))
41394139
return false;
4140-
size_t nel = jl_unbox_long(argv[2].constant);
4141-
if (nel < 0)
4142-
return false;
4140+
// Cast to a unsigned size and let `emit_const_len_memorynew`
4141+
// make sure that `nel` fits in a positive signed integer.
4142+
size_t nel = (size_t)jl_unbox_long(argv[2].constant);
41434143
*ret = emit_const_len_memorynew(ctx, typ, nel, inst);
41444144
}
41454145
else {

0 commit comments

Comments
 (0)