Changeset 776


Ignore:
Timestamp:
Apr 27, 2011, 11:47:40 AM (10 years ago)
Author:
campbell
Message:

Fix up some minor null pointer issues in Clight.
Add corresponding Cminor example and fix up pretty printer a little.

Location:
src
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • src/Clight/Csem.ma

    r744 r776  
    139139      [ Vint n1 ⇒ match v2 with
    140140        [ Vptr r2 b2 p2 ofs2 ⇒ Some ? (Vptr r2 b2 p2 (shift_offset ofs2 (mul (repr (sizeof ty)) n1)))
     141        | Vnull r ⇒ if eq n1 zero then Some ? (Vnull r) else None ?
    141142        | _ ⇒ None ? ]
    142143      | _ ⇒ None ? ]
     
    162163      [ Vptr r1 b1 p1 ofs1 ⇒ match v2 with
    163164        [ Vint n2 ⇒ Some ? (Vptr r1 b1 p1 (neg_shift_offset ofs1 (mul (repr (sizeof ty)) n2)))
     165        | _ ⇒ None ? ]
     166      | Vnull r ⇒ match v2 with
     167        [ Vint n2 ⇒ if eq n2 zero then Some ? (Vnull r) else None ?
    164168        | _ ⇒ None ? ]
    165169      | _ ⇒ None ? ]
  • src/Cminor/cminorMatitaPrinter.ml

    r758 r776  
    8484  | AST.Op_cmpf cmp -> "(Ocmpf " ^ (print_cmp cmp) ^ ")"
    8585  | AST.Op_addp -> "Oaddp"
    86   | AST.Op_subp -> "Osubp"
    87   | AST.Op_cmpp cmp -> (print_cmp cmp) ^ "Ocmpp"
     86  | AST.Op_subp -> "Osubpi" (* FIXME: there should be separate subpi and subpp ops*)
     87  | AST.Op_cmpp cmp -> "(Ocmpp " ^ (print_cmp cmp) ^ ")"
    8888
    8989let rec define_expr_labels = function
Note: See TracChangeset for help on using the changeset viewer.