From be8e209956b3f93b181eb730c743a6d72ddfbbb3 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Fri, 1 Dec 2017 22:31:08 +0100 Subject: Fix string offsets --- BuildIR.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BuildIR.hs b/BuildIR.hs index c70d538..e34d7f5 100644 --- a/BuildIR.hs +++ b/BuildIR.hs @@ -135,8 +135,10 @@ internString :: String -> BuildM Ref internString str = do i <- genId let n = "__str_cnst_" ++ show i + ref' <- genTempForType TInt ref <- genTempForType TInt - addIns $ ILea ref n + addIns $ ILea ref' n + addIns $ IAri AAdd ref ref' (Constant (refSize ref') (fromIntegral $ sizeof TInt)) state $ \s -> (ref, s {internedStrings = internedStrings s ++ [(n, str)]}) -- cgit v1.2.3-54-g00ecf