Skip to content

Commit b6cbeff

Browse files
committed
Allocate global variables before populating constants
Constants can depend on the addresses of global variables ```c int flag; int * const flag_ptr = &flag; ```
1 parent f648b72 commit b6cbeff

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

saw-central/src/SAWCentral/Crucible/LLVM/Builtins.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ import SAWCentral.Crucible.LLVM.Override
218218
import SAWCentral.Crucible.LLVM.ResolveSetupValue
219219
import SAWCentral.Crucible.LLVM.MethodSpecIR
220220
import SAWCentral.Panic (panic)
221+
import qualified Lang.Crucible.LLVM.Globals as Crucible
221222

222223
type AssumptionReason = (MS.ConditionMetadata, String)
223224

@@ -1760,7 +1761,7 @@ setupLLVMCrucibleContext pathSat lm action =
17601761
bindings (Crucible.llvmExtensionImpl ?memOpts)
17611762
Common.SAWCruciblePersonality
17621763
mem <- Crucible.populateConstGlobals bak (view Crucible.globalInitMap mtrans)
1763-
=<< Crucible.initializeMemoryConstGlobals bak ctx llvm_mod
1764+
=<< Crucible.initializeAllMemory bak ctx llvm_mod
17641765

17651766
let globals = Crucible.llvmGlobals (Crucible.llvmMemVar ctx) mem
17661767

0 commit comments

Comments
 (0)