Skip to content

Commit 35e77a2

Browse files
committed
Remove hardcoded constant folding for unary minus in cabs2cil
1 parent abe64c5 commit 35e77a2

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/frontc/cabs2cil.ml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4009,12 +4009,7 @@ and doExp (asconst: bool) (* This expression is used as a constant *)
40094009
let (se, e', t) = doExp asconst e (AExp None) in
40104010
if isIntegralType t then
40114011
let tres = integralPromotion t in
4012-
let fallback = UnOp(Neg, makeCastT ~kind:IntegerPromotion ~e:e' ~oldt:t ~newt:tres, tres) in
4013-
let e'' =
4014-
match e', tres with
4015-
| Const(CInt(i, _, _)), TInt(ik, _) -> const_if_not_overflow fallback ik (neg_cilint i)
4016-
| _ -> fallback
4017-
in
4012+
let e'' = UnOp(Neg, makeCastT ~kind:IntegerPromotion ~e:e' ~oldt:t ~newt:tres, tres) in
40184013
finishExp se e'' tres
40194014
else
40204015
if isArithmeticType t then

0 commit comments

Comments
 (0)