aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-gcc.cc
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-08-11 12:00:27 +0000
committerGitHub <noreply@github.com>2022-08-11 12:00:27 +0000
commitb28f1384830dcd2bad277208157710364e28797e (patch)
tree90a38aef7e87f385a58c6cf35c9d9e7788efd4e8 /gcc/rust/rust-gcc.cc
parenteca2ac2c23e0c8b438fd696d4f85e35c9210d8dd (diff)
parentf891a13aa2af912584176d2c595c295b77ff5ff9 (diff)
downloadgcc-b28f1384830dcd2bad277208157710364e28797e.zip
gcc-b28f1384830dcd2bad277208157710364e28797e.tar.gz
gcc-b28f1384830dcd2bad277208157710364e28797e.tar.bz2
Merge #1462
1462: Ensure we set TREE_SIDE_EFFECTS on call expressions r=philberty a=philberty When we compiling call expressions the GCC helper has quite a simple implementation to determine if there are SIDE_EFFECTS we have more information in the front-end to determine this. This adds a check that the call expression is deemed to have no side effects ensure we check this against the fndecl used. Fixes #1460 Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/rust-gcc.cc')
-rw-r--r--gcc/rust/rust-gcc.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc
index 27196e8..f396aa8 100644
--- a/gcc/rust/rust-gcc.cc
+++ b/gcc/rust/rust-gcc.cc
@@ -1848,6 +1848,9 @@ Gcc_backend::call_expression (tree fn, const std::vector<tree> &fn_args,
ret = build1_loc (location.gcc_location (), NOP_EXPR, rettype, ret);
}
+ if (!TREE_SIDE_EFFECTS (ret))
+ TREE_SIDE_EFFECTS (ret) = TREE_SIDE_EFFECTS (fndecl);
+
delete[] args;
return ret;
}