Skip to content

Commit bf39f60

Browse files
authored
Merge pull request #216 from goblint/unary-minus-constfold
Remove hardcoded constant folding for unary minus in `cabs2cil`
2 parents 0913d6a + 35e77a2 commit bf39f60

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

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)