- Timestamp:
- Mar 6, 2013, 3:48:20 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
driver/clightFromC.ml
r2773 r2790 321 321 let ezero = Expr(Econst_int(I32, zero (convertIntNat 32)), Tint(I32, Signed)) 322 322 323 let is_pointer = function 324 | Tpointer _ -> true 325 | _ -> false 326 323 327 let rec convertExpr env e = 324 328 let ty = convertTyp env e.etyp in 325 329 match e.edesc with 330 | C.EConst(C.CInt(i, _, _)) when i = Int64.zero && is_pointer ty -> 331 Expr(Ecast (ty, Expr (Econst_int (I8,zero (convertIntNat 8)), Tint (I8, Unsigned))), ty) 326 332 | C.EConst(C.CInt(i, k, _)) -> 327 333 let (_,sz) = convertIkind k in … … 694 700 match Ceval.constant_expr env ty e with 695 701 | Some(C.CInt(v, ik, _)) -> 696 begin match convertIkind ik with 697 | (_, I8) -> 698 emit 1 (Init_int8(convertInt I8 v)) 699 | (_, I16) -> 700 check_align 2; 701 emit 2 (Init_int16(convertInt I16 v)) 702 | (_, I32) -> 703 check_align 4; 704 emit 4 (Init_int32(convertInt I32 v)) 702 begin match ty with 703 | TPtr(_,_) -> 704 (* The only integer constant that is a pointer is zero *) 705 emit 2 Init_null 706 | _ -> 707 begin match convertIkind ik with 708 | (_, I8) -> 709 emit 1 (Init_int8(convertInt I8 v)) 710 | (_, I16) -> 711 check_align 2; 712 emit 2 (Init_int16(convertInt I16 v)) 713 | (_, I32) -> 714 check_align 4; 715 emit 4 (Init_int32(convertInt I32 v)) 716 end 705 717 end 706 718 | Some(C.CFloat(v, fk, _)) ->
Note: See TracChangeset
for help on using the changeset viewer.