diff options
author | Leonard Chan <leonardchan@google.com> | 2019-01-18 21:04:25 +0000 |
---|---|---|
committer | Leonard Chan <leonardchan@google.com> | 2019-01-18 21:04:25 +0000 |
commit | d3f3e16293e59b54c835e20e32050b805b9ade65 (patch) | |
tree | b1c41b23d95a6f2d10470333369f36109f718733 /clang/test/Frontend/fixed_point_errors.c | |
parent | 56d18121e2e45d711e171356d53371b3a868ec7c (diff) | |
download | bcm5719-llvm-d3f3e16293e59b54c835e20e32050b805b9ade65.tar.gz bcm5719-llvm-d3f3e16293e59b54c835e20e32050b805b9ade65.zip |
[Fixed Point Arithmetic] Fixed Point Addition Constant Expression Evaluation
This patch includes logic for constant expression evaluation of fixed point additions.
Differential Revision: https://reviews.llvm.org/D55868
llvm-svn: 351593
Diffstat (limited to 'clang/test/Frontend/fixed_point_errors.c')
-rw-r--r-- | clang/test/Frontend/fixed_point_errors.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/Frontend/fixed_point_errors.c b/clang/test/Frontend/fixed_point_errors.c index 41427e34315..43c50572573 100644 --- a/clang/test/Frontend/fixed_point_errors.c +++ b/clang/test/Frontend/fixed_point_errors.c @@ -232,3 +232,9 @@ void CheckSuffixOnIntegerLiterals() { auto auto_accum = 0k; // expected-error{{invalid suffix 'k' on integer constant}} // expected-warning@-1{{type specifier missing, defaults to 'int'}} } + +// Overflow +short _Accum sa_const = 256.0k; // expected-warning{{implicit conversion from 256.0 cannot fit within the range of values for 'short _Accum'}} +short _Fract sf_const = 1.0hk; // expected-warning{{implicit conversion from 1.0 cannot fit within the range of values for 'short _Fract'}} +unsigned _Accum ua_const = -1.0k; // expected-warning{{implicit conversion from -1.0 cannot fit within the range of values for 'unsigned _Accum'}} +short _Accum sa_const2 = 128.0k + 128.0k; // expected-warning{{implicit conversion from 256.0 cannot fit within the range of values for 'short _Accum'}} |