diff options
author | Bernhard Schommer <bernhardschommer@gmail.com> | 2017-01-31 14:44:05 +0100 |
---|---|---|
committer | Bernhard Schommer <bernhardschommer@gmail.com> | 2017-01-31 14:44:05 +0100 |
commit | ed55884ea9749f93ffd67f0734da0907fe338102 (patch) | |
tree | ae47fd6501b1cd2b5b2de31ce5872e58d0c5170e /cparser/Cutil.mli | |
parent | 3581ae495677aeca93f013d67a4d4f7c171d9cc0 (diff) | |
download | compcert-ed55884ea9749f93ffd67f0734da0907fe338102.tar.gz compcert-ed55884ea9749f93ffd67f0734da0907fe338102.zip |
Avoid overflows and report an error.
Instead of multiplying the array constant directly with the
size of the offset the cautious_mul function is used to detect
potential overflows.
Bug 20765
Diffstat (limited to 'cparser/Cutil.mli')
-rw-r--r-- | cparser/Cutil.mli | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/cparser/Cutil.mli b/cparser/Cutil.mli index a849d1fe..ee3c7625 100644 --- a/cparser/Cutil.mli +++ b/cparser/Cutil.mli @@ -114,6 +114,9 @@ val struct_layout: val offsetof: Env.t -> typ -> field -> int (* Compute the offset of a struct member *) +val cautious_mul: int64 -> int -> int option +(* Overflow-avoiding multiplication of an int64 and an int, with + result in type int. *) (* Type classification functions *) |