aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BuildIR.hs4
1 files changed, 3 insertions, 1 deletions
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)]})