diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-01-07 12:47:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-07 12:47:36 +0000 |
commit | 03e56b5181506a4e6cdb9fe86c543a57840e54c3 (patch) | |
tree | 9950e1acdb29638e42b5dc451e3232868ccfdf2c /gcc/rust/hir | |
parent | 230b55bb532338fec1a9217f9ff8808cc0043772 (diff) | |
parent | 507dbac06d845af87e488dcb1f66390b4ca12de3 (diff) | |
download | gcc-03e56b5181506a4e6cdb9fe86c543a57840e54c3.zip gcc-03e56b5181506a4e6cdb9fe86c543a57840e54c3.tar.gz gcc-03e56b5181506a4e6cdb9fe86c543a57840e54c3.tar.bz2 |
Merge #860
860: Add overflow checking on LiteralExpression r=philberty a=philberty
This checks that the literal value is within the bounds of their respective
types. I have omitted code fixing the other issue in the bug report that
overflow/max_val integers should be saturated to infinity when cast to
REAL_TYPE's this seems like something we really should have documentation
to reference in the code as to why this is the correct Rust behaviour.
Addresses #635
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/hir')
-rw-r--r-- | gcc/rust/hir/tree/rust-hir-expr.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/rust/hir/tree/rust-hir-expr.h b/gcc/rust/hir/tree/rust-hir-expr.h index 6784550..c1495d4 100644 --- a/gcc/rust/hir/tree/rust-hir-expr.h +++ b/gcc/rust/hir/tree/rust-hir-expr.h @@ -95,7 +95,8 @@ public: void accept_vis (HIRFullVisitor &vis) override; - Literal *get_literal () { return &literal; } + Literal &get_literal () { return literal; } + const Literal &get_literal () const { return literal; } protected: /* Use covariance to implement clone function as returning this object rather |