Bug fixed in string literal -> int cast
This commit is contained in:
parent
2aa64f4a37
commit
fee8ea5cb3
@ -238,7 +238,8 @@ AST *ast_cast_expr(AST *what, Type *to) {
|
|||||||
ASTExprPrimitive *ret = calloc(1, sizeof(*ret));
|
ASTExprPrimitive *ret = calloc(1, sizeof(*ret));
|
||||||
ret->nodeKind = AST_EXPR_PRIMITIVE;
|
ret->nodeKind = AST_EXPR_PRIMITIVE;
|
||||||
ret->type = to;
|
ret->type = to;
|
||||||
memcpy(&ret->val, what->exprStrLit.data, sizeof(ret->val));
|
ret->val = 0;
|
||||||
|
memcpy(&ret->val, what->exprStrLit.data, what->exprStrLit.length);
|
||||||
return (AST*) ret;
|
return (AST*) ret;
|
||||||
} else abort();
|
} else abort();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user