From 35e77a24b6e1aeff84a0eab76f8dd770229487fb Mon Sep 17 00:00:00 2001 From: Karoliine Holter Date: Fri, 30 Jan 2026 15:03:50 +0200 Subject: [PATCH] Remove hardcoded constant folding for unary minus in `cabs2cil` --- src/frontc/cabs2cil.ml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/frontc/cabs2cil.ml b/src/frontc/cabs2cil.ml index 1f0c524ad..b4366dbb6 100644 --- a/src/frontc/cabs2cil.ml +++ b/src/frontc/cabs2cil.ml @@ -4009,12 +4009,7 @@ and doExp (asconst: bool) (* This expression is used as a constant *) let (se, e', t) = doExp asconst e (AExp None) in if isIntegralType t then let tres = integralPromotion t in - let fallback = UnOp(Neg, makeCastT ~kind:IntegerPromotion ~e:e' ~oldt:t ~newt:tres, tres) in - let e'' = - match e', tres with - | Const(CInt(i, _, _)), TInt(ik, _) -> const_if_not_overflow fallback ik (neg_cilint i) - | _ -> fallback - in + let e'' = UnOp(Neg, makeCastT ~kind:IntegerPromotion ~e:e' ~oldt:t ~newt:tres, tres) in finishExp se e'' tres else if isArithmeticType t then