OSDN Git Service

* gimplify.c (mostly_copy_tree_r): Deal with BIND_EXPR.
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 3 Jul 2010 13:14:48 +0000 (13:14 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 3 Jul 2010 13:14:48 +0000 (13:14 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161774 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/cond_expr1.adb [new file with mode: 0644]

index d2e3ba5..8ef121a 100644 (file)
@@ -1,4 +1,8 @@
-2010-07-02  Jan Hubicka  <jh@suse.cz>
+2010-07-03  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gimplify.c (mostly_copy_tree_r): Deal with BIND_EXPR.
+
+2010-07-03  Jan Hubicka  <jh@suse.cz>
 
        * config/i386/i386.c (override_options): Revert accidental commit.
 
index a9c93ac..9eb8fa7 100644 (file)
@@ -868,9 +868,9 @@ mostly_copy_tree_r (tree *tp, int *walk_subtrees, void *data)
   tree t = *tp;
   enum tree_code code = TREE_CODE (t);
 
-  /* Do not copy SAVE_EXPR or TARGET_EXPR nodes themselves, but copy
-     their subtrees if we can make sure to do it only once.  */
-  if (code == SAVE_EXPR || code == TARGET_EXPR)
+  /* Do not copy SAVE_EXPR, TARGET_EXPR or BIND_EXPR nodes themselves, but
+     copy their subtrees if we can make sure to do it only once.  */
+  if (code == SAVE_EXPR || code == TARGET_EXPR || code == BIND_EXPR)
     {
       if (data && !pointer_set_insert ((struct pointer_set_t *)data, t))
        ;
@@ -895,10 +895,7 @@ mostly_copy_tree_r (tree *tp, int *walk_subtrees, void *data)
 
   /* Leave the bulk of the work to copy_tree_r itself.  */
   else
-    {
-      gcc_assert (code != BIND_EXPR);
-      copy_tree_r (tp, walk_subtrees, NULL);
-    }
+    copy_tree_r (tp, walk_subtrees, NULL);
 
   return NULL_TREE;
 }
index fb71e59..d64f505 100644 (file)
@@ -1,5 +1,9 @@
 2010-07-03  Eric Botcazou  <ebotcazou@adacore.com>
 
+       * gnat.dg/cond_expr1.adb: New test.
+
+2010-07-03  Eric Botcazou  <ebotcazou@adacore.com>
+
        * gnat.dg/modular3.adb: New test.
        * gnat.dg/modular3_pkg.ads: New helper.
 
diff --git a/gcc/testsuite/gnat.dg/cond_expr1.adb b/gcc/testsuite/gnat.dg/cond_expr1.adb
new file mode 100644 (file)
index 0000000..e1a87a3
--- /dev/null
@@ -0,0 +1,7 @@
+-- { dg-do compile }
+-- { dg-options "-gnat12" }
+
+function Cond_Expr1 (Dir : in String) return String is
+begin
+   return (if Dir (Dir'Last) = '\' then Dir else Dir & '\');
+end;