diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-01-26 21:49:56 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-01-26 21:49:56 +0100 |
commit | 56b305928143e7411e9fc39dc8d33d8078dd63eb (patch) | |
tree | 684f9a7e3b30d379b53279be908e5101791ac8d1 | |
parent | 3683460c575ce038b2cb3fa00b59dc3ff312d756 (diff) |
Fix a VERY elusive segfault.
@lieuwex
-rw-r--r-- | codegen.hs | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -126,14 +126,14 @@ variableOperand name = get >>= (maybe getGlobal getLocal . Map.lookup name . var where getLocal :: (Type, LLName) -> CGMonad A.Operand getLocal (t, nm) = do - let loadoper = A.LocalReference (toLLVMType t) (A.Name nm) + let loadoper = A.LocalReference (A.ptr (toLLVMType t)) (A.Name nm) label <- addInstr $ A.Load False loadoper Nothing 0 [] return $ A.LocalReference (toLLVMType t) (A.Name label) getGlobal :: CGMonad A.Operand getGlobal = do (t, nm) <- lookupGlobalVar name - let loadoper = A.ConstantOperand $ A.C.GlobalReference (toLLVMType t) (A.Name nm) + let loadoper = A.ConstantOperand $ A.C.GlobalReference (A.ptr (toLLVMType t)) (A.Name nm) label <- addInstr $ A.Load False loadoper Nothing 0 [] return $ A.LocalReference (toLLVMType t) (A.Name label) |