Skip to content

Commit

Permalink
fixed translateLLVMValue on string values, which was somehow giving a…
Browse files Browse the repository at this point in the history
…n incorrect translation; also fixed up the comments on translateLLVMValue to help clarify what it is supposed to return
  • Loading branch information
Eddy Westbrook committed May 2, 2022
1 parent fa82780 commit 5f6f718
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions heapster-saw/src/Verifier/SAW/Heapster/LLVMGlobalConst.hs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ ppLLVMConstExpr :: L.ConstExpr -> String
ppLLVMConstExpr ce =
L.withConfig (L.Config True True True) (show $ PPHPJ.nest 2 $ L.ppConstExpr ce)

-- | Translate a typed LLVM 'L.Value' to a Heapster permission + translation
-- | Translate a typed LLVM 'L.Value' to a Heapster shape + an element of the
-- translation of that shape to a SAW core type
translateLLVMValue :: (1 <= w, KnownNat w) => NatRepr w -> L.Type -> L.Value ->
LLVMTransM (PermExpr (LLVMShapeType w), OpenTerm)
translateLLVMValue w tp@(L.PrimType (L.Integer n)) (L.ValInteger i) =
Expand Down Expand Up @@ -124,7 +125,8 @@ translateLLVMValue _ _ (L.ValString bytes) =
foldr1 PExpr_SeqShape $
map (PExpr_FieldShape . LLVMFieldShape . ValPerm_Eq .
PExpr_LLVMWord . bvBV . BV.word8) bytes in
return (sh, unitOpenTerm)
let tm = foldr1 pairOpenTerm $ map (const unitOpenTerm) bytes in
return (sh, tm)
-- NOTE: we don't translate strings to one big bitvector value because that
-- seems to mess up the endianness
{-
Expand Down

0 comments on commit 5f6f718

Please sign in to comment.