aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Cutil.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2015-04-28 13:17:30 +0200
committerXavier Leroy <xavier.leroy@inria.fr>2015-04-28 13:17:30 +0200
commit74c3e0e8615c2d943eae813b82b11cbfe74d4a82 (patch)
tree1901feb7ca3bc0e2f293b21c582e52b69a84c61f /cparser/Cutil.ml
parent916bfc0c4f2a025e9aa642cf616cd8c6ace4ec70 (diff)
downloadcompcert-kvx-74c3e0e8615c2d943eae813b82b11cbfe74d4a82.tar.gz
compcert-kvx-74c3e0e8615c2d943eae813b82b11cbfe74d4a82.zip
Detect and reject "&" operator applied to "register" local variable or to a bit field.
Diffstat (limited to 'cparser/Cutil.ml')
-rw-r--r--cparser/Cutil.ml13
1 files changed, 13 insertions, 0 deletions
diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml
index 846010b3..221bd7cc 100644
--- a/cparser/Cutil.ml
+++ b/cparser/Cutil.ml
@@ -574,6 +574,19 @@ let is_function_type env t =
| TFun _ -> true
| _ -> false
+(* Find the info for a field access *)
+
+let field_of_dot_access env t m =
+ match unroll env t with
+ | TStruct(id, _) -> Env.find_struct_member env (id, m)
+ | TUnion(id, _) -> Env.find_union_member env (id, m)
+ | _ -> assert false
+
+let field_of_arrow_access env t m =
+ match unroll env t with
+ | TPtr(t, _) | TArray(t, _, _) -> field_of_dot_access env t m
+ | _ -> assert false
+
(* Ranking of integer kinds *)
let integer_rank = function