]> gcc.gnu.org Git - gcc.git/commitdiff
except.c (expand_start_catch_block): Fix catching a reference to pointer.
authorJason Merrill <jason@yorick.cygnus.com>
Wed, 26 Nov 1997 09:15:09 +0000 (09:15 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 26 Nov 1997 09:15:09 +0000 (04:15 -0500)
* except.c (expand_start_catch_block): Fix catching a reference
to pointer.

* init.c (build_new): Copy size to the saveable obstack.

* init.c (build_new): Stick a CLEANUP_POINT_EXPR inside the
  TRY_CATCH_EXPR for now.

From-SVN: r16726

gcc/cp/ChangeLog
gcc/cp/except.c
gcc/cp/init.c

index 8af98a4f8aede49b6baedcf975f1ecfd27f9701b..a129f0a9a527cd174517fbf4f82ff6f7d8b0c271 100644 (file)
@@ -1,3 +1,15 @@
+Wed Nov 26 01:11:24 1997  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * except.c (expand_start_catch_block): Fix catching a reference
+       to pointer.
+
+Tue Nov 25 11:28:21 1997  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * init.c (build_new): Copy size to the saveable obstack.
+
+       * init.c (build_new): Stick a CLEANUP_POINT_EXPR inside the
+       TRY_CATCH_EXPR for now.
+
 Mon Nov 24 12:15:55 1997  Jason Merrill  <jason@yorick.cygnus.com>
 
        * typeck.c (mark_addressable): Don't assume a FUNCTION_DECL
index ff7a45b94a36ea46960ca7fbedd9fbf9c2adfb5d..56b2a4175e656f55ee356402db4327e5bc8f2d07 100644 (file)
@@ -614,6 +614,13 @@ expand_start_catch_block (declspecs, declarator)
        init_type = build_reference_type (init_type);
 
       exp = get_eh_value ();
+
+      /* Since pointers are passed by value, initialize a reference to
+        pointer catch parm with the address of the value slot.  */
+      if (TREE_CODE (init_type) == REFERENCE_TYPE
+         && TREE_CODE (TREE_TYPE (init_type)) == POINTER_TYPE)
+       exp = build_unary_op (ADDR_EXPR, exp, 1);
+
       exp = expr_tree_cons (NULL_TREE,
                       build_eh_type_type (TREE_TYPE (decl)),
                       expr_tree_cons (NULL_TREE,
index 7100b565a8386a2597d717737dba3c73e894fe0d..186b6c3edf691e37c94374a9f82090c201735984 100644 (file)
@@ -2736,12 +2736,19 @@ build_new (placement, decl, init, use_global_new)
          if (placement)
            flags |= LOOKUP_SPECULATIVELY;
 
+         /* Copy size to the saveable obstack.  */
+         size = copy_node (size);
+
          cleanup = build_op_delete_call (dcode, alloc_expr, size, flags);
 
          resume_momentary (yes);
 
          if (cleanup)
            {
+             /* FIXME: this is a workaround for a crash due to overlapping
+                exception regions.  Cleanups shouldn't really happen here.  */
+             rval = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (rval), rval);
+
              rval = build (TRY_CATCH_EXPR, TREE_TYPE (rval), rval, cleanup);
              rval = build (COMPOUND_EXPR, TREE_TYPE (rval), alloc_expr, rval);
            }
This page took 0.189906 seconds and 5 git commands to generate.