aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/StructPassing.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2018-03-09 11:07:39 +0100
committerXavier Leroy <xavier.leroy@inria.fr>2018-03-09 11:07:39 +0100
commit31caa091ba19b8216dc7d26cfc47530c860514fa (patch)
tree5564794d76d86b3c5dfc355821a31f97e70c6be2 /cparser/StructPassing.ml
parentd50509fb3a74cae6c5851eeff2b54fba5cfd425c (diff)
downloadcompcert-kvx-31caa091ba19b8216dc7d26cfc47530c860514fa.tar.gz
compcert-kvx-31caa091ba19b8216dc7d26cfc47530c860514fa.zip
StructPassing: do not transform arguments to annotation built-ins
Make sure struct/union arguments to __builtin_annot and related builtins are always passed by reference using the default passing mode, regardless of the ABI for passing struct/unions to "real" functions. This ensures portability of annotations across ABIs, and avoids mismatches between the annotation text and the actual number of arguments (when a struct/union argument is passed as N integer arguments). A similar special case already existed for __builtin_va_arg.
Diffstat (limited to 'cparser/StructPassing.ml')
-rw-r--r--cparser/StructPassing.ml8
1 files changed, 6 insertions, 2 deletions
diff --git a/cparser/StructPassing.ml b/cparser/StructPassing.ml
index 3de05e19..e431d9f9 100644
--- a/cparser/StructPassing.ml
+++ b/cparser/StructPassing.ml
@@ -323,8 +323,12 @@ and transf_call env ctx opt_lhs fn args ty =
| None -> e
| Some lhs -> eassign lhs e in
match fn with
- | {edesc = EVar {C.name = "__builtin_va_arg"}} ->
- (* Do not transform the call in this case *)
+ | {edesc = EVar { C.name = "__builtin_va_arg"
+ | "__builtin_annot"
+ | "__builtin_annot_intval"
+ | "__builtin_ais_annot" } } ->
+ (* Do not transform the call in this case, just use the default
+ pass-by-reference mode for struct/union arguments. *)
opt_eassign {edesc = ECall(fn, args'); etyp = ty}
| _ ->
let call =