diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-07-26 19:47:25 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-07-30 12:51:36 +0200 |
commit | 5ad4eab2e6ffc4c7f5a11f52239377eeae26310f (patch) | |
tree | 844afcc34639f2f732735c36a8f1692071a6cb50 /gcc/d/expr.cc | |
parent | c18db639a31b9d651b3b997fee331106b25789ef (diff) | |
download | gcc-5ad4eab2e6ffc4c7f5a11f52239377eeae26310f.zip gcc-5ad4eab2e6ffc4c7f5a11f52239377eeae26310f.tar.gz gcc-5ad4eab2e6ffc4c7f5a11f52239377eeae26310f.tar.bz2 |
d: Don't generate a PREDICT_EXPR when assert contracts are turned off.
This expression is just discarded by add_stmt, so never reaches the
middle-end.
gcc/d/ChangeLog:
* expr.cc (ExprVisitor::visit (AssertExp *)): Don't generate
PREDICT_EXPR.
Diffstat (limited to 'gcc/d/expr.cc')
-rw-r--r-- | gcc/d/expr.cc | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc index 76c1e61..73e0abe 100644 --- a/gcc/d/expr.cc +++ b/gcc/d/expr.cc @@ -2085,15 +2085,9 @@ public: } else { - /* Assert contracts are turned off, if the contract condition has no - side effects can still use it as a predicate for the optimizer. */ - if (TREE_SIDE_EFFECTS (arg)) - { - this->result_ = void_node; - return; - } - - assert_fail = build_predict_expr (PRED_NORETURN, NOT_TAKEN); + /* Assert contracts are turned off. */ + this->result_ = void_node; + return; } /* Build condition that we are asserting in this contract. */ |