OCaml has a built-in notion of "unsafe" feature (see ocamlobjinfo
   output) that could serve as a starting point for that.
   
Yes, I tried this on 
    let f b =
      let a = "abcde" in
      let c = Obj.magic b in
      String.unsafe_blit c 0 a 0 5
For the .cmo, ocamlobjinfo surprisingly reports
   Uses unsafe features: no
and for the .cmx it doesn't say anything about unsafe features.
Bye,
Hendrik