Skip to content

Commit 456e2f6

Browse files
authored
aot compiler: Fix a type mismatch in compile_op_float_min_max (#3423)
Fixes #3422
1 parent 8f098a5 commit 456e2f6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

core/iwasm/compilation/aot_emit_numberic.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ compile_op_float_min_max(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
228228
bool is_f32, LLVMValueRef left, LLVMValueRef right,
229229
bool is_min)
230230
{
231+
LLVMTypeRef float_param_types[2];
231232
LLVMTypeRef param_types[2], ret_type = is_f32 ? F32_TYPE : F64_TYPE,
232233
int_type = is_f32 ? I32_TYPE : I64_TYPE;
233234
LLVMValueRef cmp, is_eq, is_nan, ret, left_int, right_int, tmp,
@@ -236,7 +237,9 @@ compile_op_float_min_max(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
236237
: (is_f32 ? "llvm.maxnum.f32" : "llvm.maxnum.f64");
237238
CHECK_LLVM_CONST(nan);
238239

239-
param_types[0] = param_types[1] = ret_type;
240+
/* Note: param_types is used by LLVM_BUILD_OP_OR_INTRINSIC */
241+
param_types[0] = param_types[1] = int_type;
242+
float_param_types[0] = float_param_types[1] = ret_type;
240243

241244
if (comp_ctx->disable_llvm_intrinsics
242245
&& aot_intrinsic_check_capability(comp_ctx,
@@ -304,7 +307,7 @@ compile_op_float_min_max(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
304307
}
305308

306309
if (!(cmp = aot_call_llvm_intrinsic(comp_ctx, func_ctx, intrinsic, ret_type,
307-
param_types, 2, left, right)))
310+
float_param_types, 2, left, right)))
308311
return NULL;
309312

310313
/* The result of XIP intrinsic is 0 or 1, should return it directly */

0 commit comments

Comments
 (0)