From 199d170b6f99802b210937ecaf332008c0c2e14c Mon Sep 17 00:00:00 2001 From: Valentin Robert Date: Thu, 17 Oct 2024 17:44:47 -0700 Subject: [PATCH] fix pattern-matching binding bug 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. --- src/Reopt/CFG/LLVM.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Reopt/CFG/LLVM.hs b/src/Reopt/CFG/LLVM.hs index 54c49071..56416857 100644 --- a/src/Reopt/CFG/LLVM.hs +++ b/src/Reopt/CFG/LLVM.hs @@ -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 | 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