summaryrefslogtreecommitdiffstats
path: root/clang/test/Frontend/fixed_point_errors.c
diff options
context:
space:
mode:
authorLeonard Chan <leonardchan@google.com>2019-01-18 21:04:25 +0000
committerLeonard Chan <leonardchan@google.com>2019-01-18 21:04:25 +0000
commitd3f3e16293e59b54c835e20e32050b805b9ade65 (patch)
treeb1c41b23d95a6f2d10470333369f36109f718733 /clang/test/Frontend/fixed_point_errors.c
parent56d18121e2e45d711e171356d53371b3a868ec7c (diff)
downloadbcm5719-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.c6
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'}}
OpenPOWER on IntegriCloud