Skip to content

Commit a6aa225

Browse files
committed
Fix pconst in constFold cast
1 parent 568dc23 commit a6aa225

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cil.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2573,7 +2573,7 @@ and constFold (machdep: bool) (e: exp) : exp =
25732573
| Const(CInt(i,k,_)), TInt(nk,a)
25742574
(* It's okay to drop a cast to const.
25752575
If the cast has any other attributes, leave the cast alone. *)
2576-
when (dropAttributes ["const"] a) = [] ->
2576+
when (dropAttributes ["const"; "pconst"] a) = [] ->
25772577
let i', _ = truncateCilint nk (mkCilintIk k i) in
25782578
Const(CInt(i', nk, None))
25792579
| e', _ -> CastE (t, e')
@@ -6471,7 +6471,7 @@ let caseRangeFold (l: label list) =
64716471
match constFold true el, constFold true eh with
64726472
Const(CInt(il, ilk, _)), Const(CInt(ih, ihk, _)) ->
64736473
mkCilintIk ilk il, mkCilintIk ihk ih, commonIntKind ilk ihk
6474-
| _ -> E.s (error "Cannot understand the constants in case range")
6474+
| _ -> E.s (error "Cannot understand the constants in case range (%a and %a)" d_exp el d_exp eh)
64756475
in
64766476
if compare_cilint il ih > 0 then
64776477
E.s (error "Empty case range");

0 commit comments

Comments
 (0)