aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-08-11 12:34:13 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-08-11 12:34:13 +0100
commitf891a13aa2af912584176d2c595c295b77ff5ff9 (patch)
tree90a38aef7e87f385a58c6cf35c9d9e7788efd4e8
parenteca2ac2c23e0c8b438fd696d4f85e35c9210d8dd (diff)
downloadgcc-f891a13aa2af912584176d2c595c295b77ff5ff9.zip
gcc-f891a13aa2af912584176d2c595c295b77ff5ff9.tar.gz
gcc-f891a13aa2af912584176d2c595c295b77ff5ff9.tar.bz2
Ensure we set TREE_SIDE_EFFECTS on call expressions
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
-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;
}