aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2017-07-25 14:47:16 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2017-07-25 14:47:16 +0000
commita8697b270e4cf3a34dbf23c16952b070b7d73c09 (patch)
tree6a4b6112e6b6a6551d2289e36e1ae8f78b55a3c0
parent288fe52ed1db0510d16a31a0b4cbc8ae0d4e288f (diff)
downloadgcc-a8697b270e4cf3a34dbf23c16952b070b7d73c09.zip
gcc-a8697b270e4cf3a34dbf23c16952b070b7d73c09.tar.gz
gcc-a8697b270e4cf3a34dbf23c16952b070b7d73c09.tar.bz2
gimple.c (gimple_assign_set_rhs_with_ops): Do not ask gsi_replace to update EH info here.
* gimple.c (gimple_assign_set_rhs_with_ops): Do not ask gsi_replace to update EH info here. ada/ * checks.adb (Apply_Divide_Checks): Ensure that operands are not evaluated twice. From-SVN: r250525
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/checks.adb7
-rw-r--r--gcc/gimple.c2
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gnat.dg/opt66.adb13
6 files changed, 35 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 34bbe01..cb7b47d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2017-07-25 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gimple.c (gimple_assign_set_rhs_with_ops): Do not ask gsi_replace
+ to update EH info here.
+
2017-07-25 Alexander Monakov <amonakov@ispras.ru>
* match.pd ((X * CST1) * CST2): Simplify to X * (CST1 * CST2).
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 5d6939c..3daed1e 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2017-07-25 Javier Miranda <miranda@adacore.com>
+
+ * checks.adb (Apply_Divide_Checks): Ensure that operands are not
+ evaluated twice.
+
2017-07-19 Jakub Jelinek <jakub@redhat.com>
* gcc-interface/ada-tree.h (TYPE_OBJECT_RECORD_TYPE,
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 6162a0e..a6670fa 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -1818,6 +1818,13 @@ package body Checks is
and then
((not LOK) or else (Llo = LLB))
then
+ -- Ensure that expressions are not evaluated twice (once
+ -- for their runtime checks and once for their regular
+ -- computation).
+
+ Force_Evaluation (Left, Mode => Strict);
+ Force_Evaluation (Right, Mode => Strict);
+
Insert_Action (N,
Make_Raise_Constraint_Error (Loc,
Condition =>
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 488f8c8..479f90c 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1613,7 +1613,7 @@ gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
gimple *new_stmt = gimple_alloc (gimple_code (stmt), new_rhs_ops + 1);
memcpy (new_stmt, stmt, gimple_size (gimple_code (stmt)));
gimple_init_singleton (new_stmt);
- gsi_replace (gsi, new_stmt, true);
+ gsi_replace (gsi, new_stmt, false);
stmt = new_stmt;
/* The LHS needs to be reset as this also changes the SSA name
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6c25221..6b0336c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2017-07-25 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/opt66.adb: New test.
+
2017-07-25 Alexander Monakov <amonakov@ispras.ru>
* gcc.dg/tree-ssa/assoc-2.c: Enhance.
diff --git a/gcc/testsuite/gnat.dg/opt66.adb b/gcc/testsuite/gnat.dg/opt66.adb
new file mode 100644
index 0000000..94a1790
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt66.adb
@@ -0,0 +1,13 @@
+-- { dg-do compile }
+-- { dg-options "-O" }
+
+procedure Opt66 (I : Integer) is
+ E : exception;
+begin
+ if I = 0 then
+ raise E;
+ end if;
+ Opt66 (I - I / abs (I));
+exception
+ when others => null;
+end;