aboutsummaryrefslogtreecommitdiffstats
path: root/cfrontend
diff options
context:
space:
mode:
authorMichael Schmidt <github@mschmidt.me>2016-10-19 16:28:55 +0200
committerMichael Schmidt <github@mschmidt.me>2016-10-19 16:28:55 +0200
commitdfdc844ee7b08fda327798350125b6e79727dc27 (patch)
treeaa096036123a82ca29c2528a08c6e26cb7faea88 /cfrontend
parent8c77560102fbad568209544d30679ca5a3310b37 (diff)
downloadcompcert-kvx-dfdc844ee7b08fda327798350125b6e79727dc27.tar.gz
compcert-kvx-dfdc844ee7b08fda327798350125b6e79727dc27.zip
implement checks for parameters of '__builtin_memcpy_aligned' (bug 20222)
Diffstat (limited to 'cfrontend')
-rw-r--r--cfrontend/C2C.ml8
1 files changed, 4 insertions, 4 deletions
diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml
index 85f94ad0..5d75aa6a 100644
--- a/cfrontend/C2C.ml
+++ b/cfrontend/C2C.ml
@@ -362,10 +362,10 @@ let make_builtin_memcpy args =
match Initializers.constval !comp_env al with
| Errors.OK(Vint n) -> n
| _ -> error "alignment argument of '__builtin_memcpy_aligned' must be a constant"; Integers.Int.one in
- if Integers.Int.is_power2 al1 = None
- then error "alignment argument of '__builtin_memcpy_aligned' must be a power of 2";
- if Integers.Int.modu sz1 al1 <> Integers.Int.zero
- then error "alignment argument of '__builtin_memcpy_aligned' must be a divisor of the size";
+ if Integers.Int.is_power2 al1 = None then
+ error "alignment argument of '__builtin_memcpy_aligned' must be a power of 2";
+ if Integers.Int.modu sz1 al1 <> Integers.Int.zero then
+ error "alignment argument of '__builtin_memcpy_aligned' must be a divisor of the size";
(* Issue #28: must decay array types to pointer types *)
Ebuiltin(EF_memcpy(sz1, al1),
Tcons(typeconv(typeof dst),