aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-tree.cc
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2022-08-26 08:44:02 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2023-01-31 14:16:49 +0100
commit9c87dc0afe059ce54280dd81ff773f910a6dffdf (patch)
tree83fb51fefaa069421de491008642cd29ae08c2c7 /gcc/rust/backend/rust-tree.cc
parent41547275c5e9a9b7a92898106180b2d295e1ed36 (diff)
downloadgcc-9c87dc0afe059ce54280dd81ff773f910a6dffdf.zip
gcc-9c87dc0afe059ce54280dd81ff773f910a6dffdf.tar.gz
gcc-9c87dc0afe059ce54280dd81ff773f910a6dffdf.tar.bz2
gccrs: backend: Add overflow checks to every arithmetic operation
gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Insert overflow checks logic. (CompileExpr::array_copied_expr): Insert overflow checks logic. * backend/rust-compile-item.cc (CompileItem::visit): Insert overflow checks logic. * backend/rust-compile-type.cc (TyTyResolveCompile::visit): Insert overflow checks logic. * rust-gcc.cc (Gcc_backend::arithmetic_or_logical_expression): Differentiate existing function from `arithmetic_or_logical_expression_checked`. This function does insert perform overflow checks. (Gcc_backend::arithmetic_or_logical_expression_checked): New function. (is_overflowing_expr): New function. Check if an expression is an overflowing one (ADD, SUB, MUL). (fetch_overflow_builtins): New function. * rust-backend.h: Declare `arithmetic_or_logical_expression_checked` in abstract `Backend` class. gcc/testsuite/ChangeLog: * rust/debug/win64-abi.rs: Fix assertion to take into account overflow builtins * rust/compile/torture/macro-issue1426.rs: Moved to... * rust/execute/torture/macro-issue1426.rs: ...here. * rust/execute/torture/overflow1.rs: New test.
Diffstat (limited to 'gcc/rust/backend/rust-tree.cc')
0 files changed, 0 insertions, 0 deletions