From f64f691a43f474b450f29795b4bc68bc2ef6231e Mon Sep 17 00:00:00 2001 From: lemon Date: Fri, 19 Aug 2022 06:57:21 +0200 Subject: take alignment in allocator --- src/parse.cff | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/parse.cff') diff --git a/src/parse.cff b/src/parse.cff index b42d45a..1449eab 100644 --- a/src/parse.cff +++ b/src/parse.cff @@ -858,7 +858,7 @@ fn typematchestarg(targ *const Type, ty *const Type) bool { } fn exprdup(alloc *Allocator, ex Expr) *Expr { - return memcpy(alloc->alloc(sizeof(ex)), &ex, sizeof(ex)); + return memcpy(alloc->alloc(sizeof(ex), alignof(ex)), &ex, sizeof(ex)); } fn islvalue(ex Expr) bool { @@ -955,7 +955,7 @@ fn mergetoktrees(alloc *Allocator, src *[#]Tok, n int) [#]Tok { ++total; } } - let d *Tok = alloc->alloc(total * sizeof Tok); + let d *Tok = alloc->alloc(total * sizeof Tok, alignof Tok); let len = 0; for let i = 0; i < n; ++i { if i > 0 { @@ -1687,7 +1687,7 @@ fn parseexpr(P *Parser) Expr { //////////////////////// fn stmtdup(alloc *Allocator, st Stmt) *Stmt { - return memcpy(alloc->alloc(sizeof(st)), &st, sizeof(st)); + return memcpy(alloc->alloc(sizeof(st), alignof(st)), &st, sizeof(st)); } typedef StmtYielder *fn(Stmt, *void) void; -- cgit v1.2.3