Skip to content

Commit

Permalink
fix pattern-matching binding bug
Browse files Browse the repository at this point in the history
The old code was doing pattern-matching on a shape for some type, and
binding the insides of the constructor to a variable name, but then
using that variable as if it still had the constructor around.
  • Loading branch information
Ptival committed Oct 18, 2024
1 parent f0c8453 commit b67d975
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Reopt/CFG/LLVM.hs
Original file line number Diff line number Diff line change
Expand Up @@ -985,11 +985,11 @@ appToLLVM lhs app = bbArchConstraints $ do
case (typeOfResult, tx, ty) of
(_, Just (FPtrTy _), Just (FPtrTy _)) ->
error "Inferred a pointer type for both addends, this suggests a bug in the constraint generation/solving!"
(Just (FPtrTy lhsty), Just FPtrTy{}, Just FNumTy{})
(Just lhsty@(FPtrTy _), Just FPtrTy{}, Just FNumTy{})
| FnAssignedValue FnAssignment{fnAssignRhs = FnAddrWidthConstant o} <- y ->
bvAddPtrOffset (tyToLLVMType ptrWidth lhsty) x o
bvAddPtrOffset (tyToLLVMType ptrWidth (FPtrTy lhsty)) x o
| otherwise -> bvAddPtrSymbolic (tyToLLVMType ptrWidth lhsty) x y
(Just (FPtrTy lhsty), Just FNumTy{}, Just FPtrTy{})
(Just lhsty@(FPtrTy _), Just FNumTy{}, Just FPtrTy{})
| FnAssignedValue FnAssignment{fnAssignRhs = FnAddrWidthConstant o} <- x ->
bvAddPtrOffset (tyToLLVMType ptrWidth lhsty) y o
| otherwise -> bvAddPtrSymbolic (tyToLLVMType ptrWidth lhsty) y x
Expand Down

0 comments on commit b67d975

Please sign in to comment.