diff --git a/src/cc/builtin.c b/src/cc/builtin.c index 01aa6da5c..da31260a5 100644 --- a/src/cc/builtin.c +++ b/src/cc/builtin.c @@ -253,8 +253,8 @@ static VReg *gen_alloca(Expr *expr) { assert(curfunc != NULL); Expr *size = args->data[0]; const Token *token = size->token; - Expr *aligned_size = new_expr_bop( - EX_BITAND, &tySSize, token, + Expr *aligned_size = new_expr_int_bop( + EX_BITAND, token, new_expr_addsub(EX_ADD, token, make_cast(&tySSize, token, size, false), new_expr_fixlit(&tySSize, token, stack_align - 1)), new_expr_fixlit(&tySSize, token, -stack_align)); diff --git a/src/wcc/gen_wasm.c b/src/wcc/gen_wasm.c index 9f8d5beb8..49156204f 100644 --- a/src/wcc/gen_wasm.c +++ b/src/wcc/gen_wasm.c @@ -1961,11 +1961,11 @@ static void gen_alloca(Expr *expr, enum BuiltinFunctionPhase phase) { assert(curfunc != NULL); Expr *size = args->data[0]; const Token *token = size->token; - Expr *aligned_size = - new_expr_bop(EX_BITAND, &tySSize, token, - new_expr_addsub(EX_ADD, token, make_cast(&tySSize, token, size, false), - new_expr_fixlit(&tySSize, token, stack_align - 1)), - new_expr_fixlit(&tySSize, token, -stack_align)); + Expr *aligned_size = new_expr_int_bop( + EX_BITAND, token, + new_expr_addsub(EX_ADD, token, make_cast(&tySSize, token, size, false), + new_expr_fixlit(&tySSize, token, stack_align - 1)), + new_expr_fixlit(&tySSize, token, -stack_align)); Expr *spvar = get_sp_var(); gen_expr_stmt(new_expr_bop(EX_ASSIGN, &tyVoid, NULL, spvar,