Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-24.04]
cabal: ["3.10.3.0"]
cabal: ["3.14.1.0"]
ghc: ["9.4.8", "9.6.7", "9.8.4"]
haddock: [true]
run-tests: [true]
Expand All @@ -96,14 +96,14 @@ jobs:
# tests with the newest LTS release, we won't bother testing this one.
- os: ubuntu-22.04
ghc: "9.6.7"
cabal: "3.10.3.0"
cabal: "3.14.1.0"
haddock: false
run-tests: false
hpc: false
# Include one job with HPC enabled
- os: ubuntu-24.04
ghc: "9.6.7"
cabal: "3.10.3.0"
cabal: "3.14.1.0"
haddock: false
run-tests: true
hpc: true
Expand Down
82 changes: 69 additions & 13 deletions compute-coverage.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -Eeuxo pipefail
set -uo pipefail

# This script generates an HTML coverage report for any tests run within the
# saw-script repo. It uses HPC, which is a tool in the standard GHC
Expand All @@ -16,9 +16,18 @@ set -Eeuxo pipefail
# Combine .tix files
# Avoid tripping on an existing all.tix from a prior run
SUM_TIX="all.tix"
TIXFILES=$(find . ! -path ./all.tix -name "*.tix" -print | sort)

echo "Running: hpc sum --output=$SUM_TIX ..."
hpc sum --output=$SUM_TIX --union --exclude=Main \
--exclude=SAWVersion.GitRev --exclude=SAWVersion.GitRevAux \
$(find . ! -path ./all.tix -name "*.tix" -print)
$TIXFILES
if [ $? != 0 ]; then
echo "TIXFILES was:"
echo "$TIXFILES" | awk '{ printf " %s\n", $0 }'
echo "Failed. Help?" 1>&2
exit 1
fi

# Find the HPC dir, and don't trip on old versions after a version bump.
# See saw-script #2114.
Expand All @@ -30,6 +39,11 @@ hpc sum --output=$SUM_TIX --union --exclude=Main \
# -v0 (verbosity 0) prevents cabal from accidentally including extraneous
# data (see saw-script #2103)
SAW=$(cabal list-bin -v0 exe:saw)
if [ $? != 0 ]; then
echo "cabal list-bin failed? help..." 1>&2
exit 1
fi
echo "SAW: $SAW"

# Now what we want is the top-level build dir for the saw package.
# As of when #2114 was merged, the path we were getting was:
Expand Down Expand Up @@ -61,6 +75,7 @@ SAW=$(cabal list-bin -v0 exe:saw)
# difficult or fragile. Trying to figure $TARGET or $GHC would be
# messy, but we still wouldn't need to do that.)
BUILDDIR=$(echo "$SAW" | sed 's,/build/saw/saw$,,;s,/x/saw$,,')
echo "BUILDDIR: $BUILDDIR"

case "$BUILDDIR" in
*/saw-*.*) ;;
Expand Down Expand Up @@ -91,20 +106,31 @@ esac
# hpc/vanilla/mix. The previous version of this code looked for a
# single 'hpc' dir and then iterated through its hpc/vanilla/mix; here
# what we'll do is just find all hpc/vanilla/mix/* dirs.
#
# As of #3252, we have moved to a newer Cabal version and that seems
# to change the way hpc finds the mix files. The old Cabal version
# wanted every top-level subdir of every hpc/vanilla/mix dir. The new
# one wants just the hpc/vanilla/mix dirs. This is quite a bit simpler
# to extract. (I don't entirely understand why changing the Cabal
# version changes the hpc behavior, but I guess hpc must be linked to
# the Cabal library. Anyway, if the behavior ever changes back,
# consider fishing the older version of this logic out of the
# history.)
HPCDIRS=$(find "$BUILDDIR" -path '*/hpc/vanilla/mix' -type d -print | sort)

HPC_ARGS=""
for d1 in $(find "$BUILDDIR" -path '*/hpc/vanilla/mix' -type d -print); do
for d2 in "$d1"/*; do
if [ "$d2" = "$d1/*" ]; then
continue
fi
HPC_ARGS="${HPC_ARGS} --hpcdir=${d2}"
done
done
# Print what we found. Back-substitute BUILDDIR; the paths are
# enormous and it's hard enough to read this way.
echo "HPCDIRS:"
echo "$HPCDIRS" | awk '
{
gsub(builddir, "$BUILDDIR", $0);
for (i=1;i<=NF;i++) printf " %s\n", $i;
}
' "builddir=$BUILDDIR"

# Check if we actually found stuff, in case we didn't, and bail with
# an error message instead of generating hpc's usage message.
if [ "x$HPC_ARGS" = x ]; then
if [ "x$HPCDIRS" = x ]; then
echo "$0: Found no paths matching hpc/vanilla/mix/* in $BUILDDIR" 1>&2
echo "$0: There are the following hpc dirs:" 1>&2
find "$BUILDDIR" -type d -name hpc -print 1>&2
Expand All @@ -113,5 +139,35 @@ if [ "x$HPC_ARGS" = x ]; then
echo "$0: ...help?" 1>&2
exit 1
fi


# Now stick --hpcdir= in front of each one. I separated this out to
# improve the legibility of the prints above during one of the rounds
# of mysterious failures.
HPC_ARGS=$(echo "$HPCDIRS" |\
awk '{ for (i=1;i<=NF;i++) printf " --hpcdir=%s", $i; printf "\n"; }')

echo "Running:"
echo " hpc markup --destdir=hpc-html <<HPC_ARGS>> ${SUM_TIX}"
hpc markup --destdir=hpc-html ${HPC_ARGS} ${SUM_TIX}
if [ $? != 0 ]; then
(
echo "Failed."
echo "HPC_ARGS:"
echo "$HPC_ARGS" | awk '
{
gsub(builddir, "$BUILDDIR", $0);
for (i=1;i<=NF;i++) printf " %s\n", $i;
}
' "builddir=$BUILDDIR"

echo "Files in HPCDIRS:"
find $HPCDIRS -type f | sort | awk '
{
gsub(builddir, "$BUILDDIR", $0);
printf " %s\n", $0
}
' "builddir=$BUILDDIR"
echo "Help!!"
) 1>&2
exit 1
fi
2 changes: 1 addition & 1 deletion crux-mir-comp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ RUN case ${TARGETPLATFORM} in \
chmod +x /home/crux-mir-comp/ghcup-download/bin/ghcup
RUN mkdir -p /home/crux-mir-comp/.ghcup && \
ghcup --version && \
ghcup install cabal 3.10.3.0 && \
ghcup install cabal 3.14.1.0 && \
ghcup install ghc 9.6.7 && \
ghcup set ghc 9.6.7

Expand Down
40 changes: 30 additions & 10 deletions cryptol-saw-core/src/CryptolSAWCore/Cryptol.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1829,20 +1829,40 @@ importName cnm =
qn = cryptolQualName [] [] shortNm (Just (C.nameUnique cnm))
in pure (mkImportedName qn)

| otherwise ->
| otherwise -> do
let (topMod, nested) = C.modPathSplit (C.ogModule og)
topChunks = C.modNameChunksText topMod
nestedNms = map C.identText nested
-- If the name came from a module parameter, add the module
-- parameter identifier to distinguish between names that have the
-- same identifier but come from different module parameters (see
-- #1892)
ifaceNms = case C.ogFromParam og of
Just i -> [C.identText i]
Nothing -> []
shortNm = C.identText (C.nameIdent cnm)
qn = cryptolQualName topChunks (nestedNms ++ ifaceNms) shortNm Nothing
in pure (mkImportedName qn)
qn = cryptolQualName topChunks nestedNms shortNm Nothing

-- As of May 2026 and Cryptol #2059 (possibly earlier),
-- the `C.ogFromParam` field that says if a name came
-- from a module parameter is only supposed to be
-- present in interfaces, which we can't import
-- directly, or unapplied functors, which we don't
-- support. If it appears nonempty, fail. (This should
-- maybe be a panic; it isn't clear if an unsupported
-- import will fail upstream or make it to here and then
-- need to fail in a user-facing way.)
--
-- Prior to this point we'd take the name and append it
-- to `nestedNms`, because it used to be possible to get
-- duplicate names in applied functors that had multiple
-- instances of the same interface argument. See #1892.
-- If necessary, we can do that again in the future. If
-- mucking with this, be sure to run test1892, and also
-- test3000.
--
-- Note if making this a panic: be sure it actually gets
-- evaluated.
case C.ogFromParam og of
Nothing -> pure ()
Just i ->
fail $ Text.unpack $ "Unexpected/unsupported module " <>
"parameter name " <> C.identText i <>
" in Cryptol name " <> QN.ppQualName qn
pure (mkImportedName qn)

-- | Map 'bindName' over a list of names and signatures, returning an updated
-- 'CryptolEnv' and a list of fresh SAWCore variables.
Expand Down
2 changes: 1 addition & 1 deletion deps/cryptol
Submodule cryptol updated 120 files
2 changes: 1 addition & 1 deletion deps/language-sally
2 changes: 1 addition & 1 deletion deps/macaw
Submodule macaw updated 90 files
+10 −0 base/macaw-base.cabal
+1 −1,451 base/src/Data/Macaw/AbsDomain/AbsState.hs
+1,516 −0 base/src/Data/Macaw/AbsDomain/AbsState/Internal.hs
+4 −0 base/src/Data/Macaw/AbsDomain/JumpBounds.hs
+276 −0 base/test/AbsDomain/AbsValueTests.hs
+234 −0 base/test/AbsDomain/FinSetTests.hs
+301 −0 base/test/AbsDomain/Gen.hs
+147 −0 base/test/AbsDomain/StridedIntervalTests.hs
+18 −7 base/test/Main.hs
+97 −81 cabal.project.freeze.ghc-9.10.2
+98 −82 cabal.project.freeze.ghc-9.6.7
+98 −82 cabal.project.freeze.ghc-9.8.4
+1 −1 deps/asl-translator
+1 −1 deps/bv-sized
+1 −1 deps/bv-sized-float
+1 −1 deps/crucible
+1 −1 deps/dismantle
+1 −1 deps/dwarf
+1 −1 deps/elf-edit
+1 −1 deps/flexdis86
+1 −1 deps/grift
+1 −1 deps/llvm-pretty
+1 −1 deps/llvm-pretty-bc-parser
+1 −1 deps/semmc
+1 −1 deps/what4
+2 −2 macaw-aarch32-symbolic/macaw-aarch32-symbolic.cabal
+1 −1 macaw-aarch32-symbolic/src/Data/Macaw/AArch32/Symbolic.hs
+1 −1 macaw-aarch32-symbolic/src/Data/Macaw/AArch32/Symbolic/ABI.hs
+1 −1 macaw-aarch32-symbolic/src/Data/Macaw/AArch32/Symbolic/Functions.hs
+1 −1 macaw-aarch32-symbolic/tests/Main.hs
+2 −2 macaw-aarch32/macaw-aarch32.cabal
+1 −1 macaw-aarch32/src/Data/Macaw/ARM.hs
+1 −1 macaw-aarch32/src/Data/Macaw/ARM/Disassemble.hs
+1 −1 macaw-aarch32/src/Data/Macaw/ARM/Eval.hs
+1 −1 macaw-aarch32/src/Data/Macaw/ARM/Identify.hs
+1 −1 macaw-aarch32/tests/ARMTests.hs
+1 −1 macaw-dump/macaw-dump.cabal
+1 −1 macaw-dump/src/Data/Macaw/Dump/Discover.hs
+2 −2 macaw-ppc-symbolic/macaw-ppc-symbolic.cabal
+1 −1 macaw-ppc-symbolic/src/Data/Macaw/PPC/Symbolic/Functions.hs
+1 −1 macaw-ppc-symbolic/src/Data/Macaw/PPC/Symbolic/Regs.hs
+1 −1 macaw-ppc-symbolic/tests/Main.hs
+2 −2 macaw-ppc/macaw-ppc.cabal
+1 −1 macaw-ppc/src/Data/Macaw/PPC.hs
+1 −1 macaw-ppc/src/Data/Macaw/PPC/Arch.hs
+1 −1 macaw-ppc/src/Data/Macaw/PPC/Disassemble.hs
+1 −1 macaw-ppc/src/Data/Macaw/PPC/Eval.hs
+1 −1 macaw-ppc/src/Data/Macaw/PPC/Identify.hs
+1 −1 macaw-ppc/src/Data/Macaw/PPC/Operand.hs
+1 −1 macaw-ppc/tests/PPC64InstructionCoverage.hs
+1 −1 macaw-ppc/tests/PPCTests.hs
+2 −2 macaw-riscv-symbolic/macaw-riscv-symbolic.cabal
+1 −1 macaw-riscv-symbolic/src/Data/Macaw/RISCV/Symbolic/Regs.hs
+1 −1 macaw-riscv-symbolic/tests/Main.hs
+4 −2 macaw-riscv/macaw-riscv.cabal
+1 −1 macaw-riscv/src/Data/Macaw/RISCV/Disassemble.hs
+2 −5 macaw-riscv/src/Data/Macaw/RISCV/Disassemble/Monad.hs
+1 −1 macaw-riscv/src/Data/Macaw/RISCV/Eval.hs
+1 −1 macaw-riscv/src/Data/Macaw/RISCV/Identify.hs
+1 −1 macaw-riscv/tests/RISCVTests.hs
+3 −3 refinement/macaw-refinement.cabal
+1 −1 refinement/src/Data/Macaw/Refinement/FuncBlockUtils.hs
+1 −1 refinement/src/Data/Macaw/Refinement/Path.hs
+2 −2 refinement/src/Data/Macaw/Refinement/SymbolicExecution.hs
+2 −2 refinement/src/Data/Macaw/Refinement/UnknownTransfer.hs
+2 −2 refinement/tools/Summary.hs
+2 −2 refinement/tools/run-refinement.hs
+4 −2 symbolic/macaw-symbolic.cabal
+2 −1 symbolic/src/Data/Macaw/Symbolic.hs
+42 −35 symbolic/src/Data/Macaw/Symbolic/CrucGen.hs
+1 −1 symbolic/src/Data/Macaw/Symbolic/MemOps.hs
+2 −1 symbolic/src/Data/Macaw/Symbolic/Memory/Common.hs
+2 −2 symbolic/src/Data/Macaw/Symbolic/Memory/Lazy/Internal.hs
+1 −1 symbolic/src/Data/Macaw/Symbolic/Memory/Strings.hs
+1 −1 symbolic/src/Data/Macaw/Symbolic/Regs.hs
+2 −2 symbolic/src/Data/Macaw/Symbolic/Testing.hs
+4 −2 x86/src/Data/Macaw/X86/InstructionDef.hs
+11 −10 x86/src/Data/Macaw/X86/Semantics.hs
+5 −0 x86/tests/x64/Makefile
+26 −0 x86/tests/x64/test-jumptable-mask.c
+ x86/tests/x64/test-jumptable-mask.o
+12 −0 x86/tests/x64/test-jumptable-mask.o.expected
+2 −2 x86_symbolic/macaw-x86-symbolic.cabal
+1 −1 x86_symbolic/src/Data/Macaw/X86/Crucible.hs
+1 −1 x86_symbolic/src/Data/Macaw/X86/Symbolic/ABI/SysV.hs
+1 −1 x86_symbolic/src/Data/Macaw/X86/Symbolic/Regs.hs
+1 −1 x86_symbolic/tests/Main.hs
+5 −0 x86_symbolic/tests/pass/Makefile
+33 −0 x86_symbolic/tests/pass/switch-jump-table.c
+ x86_symbolic/tests/pass/switch-jump-table.opt.exe
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Malformed term: let { L@free : Num;
}
in fix x`6
(\(hash : x`6) ->
ecCat x`1 L@free x`3 [|:SHA__parameter::H0]
ecCat x`1 L@free x`3 [|:Parameter::H0]
(coerce (seq x`7 x`3) (seq L@free x`3)
(seq_cong1 x`7 L@free x`3 (unsafeAssert Num x`7 L@free))
(seqMap #(x`3, x`4) x`3 x`7
Expand Down
1 change: 1 addition & 0 deletions saw-central/src/SAWCentral/Crucible/LLVM/Setup/Value.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The printing code for the types in this module lives in
(apart from LLVMModule, since we don't export its contents)
-}

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ImplicitParams #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE OverloadedStrings #-}
Expand Down
1 change: 1 addition & 0 deletions saw-core-what4/src/SAWCoreWhat4/Uninterp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ uninterpreted functions, there's a special case for terms that started as
SAW Core *variables* rather than SAW Core *constant*, and don't have any
arguments---these use `bindSAWTerm` instead of `sawRegisterSymFunInterp`.
-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
Expand Down
7 changes: 6 additions & 1 deletion saw-core/src/SAWCore/Fingerprint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@ module SAWCore.Fingerprint
( fingerprintSATQuery
) where

-- FUTURE: this and the explicit import from Data.Foldable can be
-- dropped once we no longer support building with GHC 9.8 or earlier
-- (base 4.19 and earlier).
import Prelude hiding (Foldable(..))

import Control.Monad.Reader (ReaderT, MonadReader, runReaderT, ask)
import Control.Monad.State.Strict (State, MonadState, state, gets, modify', evalState)
import qualified Crypto.Hash.SHA256 as SHA256
import Data.Binary (encode)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Builder as BS
import Data.ByteString.Lazy (ByteString, singleton)
import Data.Foldable (foldl')
import Data.Foldable (Foldable(..)) -- for foldl'
import Data.IntMap.Strict (IntMap)
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Map.Strict as Map
Expand Down
2 changes: 1 addition & 1 deletion saw-remote-api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ RUN case ${TARGETPLATFORM} in \
chmod +x /home/saw/ghcup-download/bin/ghcup
RUN mkdir -p /home/saw/.ghcup && \
ghcup --version && \
ghcup install cabal 3.10.3.0 && \
ghcup install cabal 3.14.1.0 && \
ghcup install ghc 9.6.7 && \
ghcup set ghc 9.6.7

Expand Down
8 changes: 4 additions & 4 deletions saw.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -718,11 +718,11 @@ library saw-server

build-depends:
-- upstream packages from hackage
base >=4.11.1.0 && <4.20,
base >=4.11.1.0 && <4.22,
aeson >= 1.4.2 && < 2.3,
base64-bytestring,
bytestring,
containers >= 0.6 && < 0.7,
containers >= 0.6 && < 0.8,
cryptonite,
cryptonite-conduit,
directory,
Expand Down Expand Up @@ -830,11 +830,11 @@ executable saw-remote-api

build-depends:
-- upstream packages from hackage
base >=4.11.1.0 && <4.20,
base >=4.11.1.0 && <4.22,
aeson >= 1.4.2 && < 2.3,
base64-bytestring,
bytestring,
containers >= 0.6 && < 0.7,
containers >= 0.6 && < 0.8,
cryptonite,
cryptonite-conduit,
directory,
Expand Down
2 changes: 1 addition & 1 deletion saw/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ RUN case ${TARGETPLATFORM} in \
chmod +x /home/saw/ghcup-download/bin/ghcup
RUN mkdir -p /home/saw/.ghcup && \
ghcup --version && \
ghcup install cabal 3.10.3.0 && \
ghcup install cabal 3.14.1.0 && \
ghcup install ghc 9.6.7 && \
ghcup set ghc 9.6.7
RUN cabal v2-update
Expand Down
Loading