This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Re: gcc trunk rev. 127646 breaks bootstrap during stage 3
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Guenther <richard dot guenther at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 21 Aug 2007 13:45:55 -0400
- Subject: Re: [C++ PATCH] Re: gcc trunk rev. 127646 breaks bootstrap during stage 3
- References: <Pine.LNX.4.64.0708201608170.6500@veith-web.com> <de8d50360708200723v9a63a6dtf265fd2da5f593b3@mail.gmail.com> <de8d50360708200726y1ba8eca2pd46de40bdbf966ab@mail.gmail.com> <20070820163316.GY2063@devserv.devel.redhat.com> <84fc9c000708210514h23572eb9jb1de63c7f8fe829d@mail.gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Aug 21, 2007 at 02:14:41PM +0200, Richard Guenther wrote:
> I think the target expr one is better though I cannot approve the patch.
Jason approved offline following 3rd version which I have
bootstrapped/regtested and committed:
2007-08-21 Jakub Jelinek <jakub@redhat.com>
* init.c (build_new_1): Use get_target_expr instead of save_expr.
* g++.dg/init/new24.C: New test.
--- gcc/cp/init.c.jj 2007-08-21 08:13:43.000000000 +0200
+++ gcc/cp/init.c 2007-08-21 17:35:08.000000000 +0200
@@ -1755,7 +1755,7 @@ build_new_1 (tree placement, tree type,
placement_expr = NULL_TREE;
else
{
- placement_expr = save_expr (TREE_VALUE (placement));
+ placement_expr = get_target_expr (TREE_VALUE (placement));
placement = tree_cons (NULL_TREE, placement_expr, NULL_TREE);
}
--- gcc/testsuite/g++.dg/init/new24.C.jj 2007-08-21 08:19:22.000000000 +0200
+++ gcc/testsuite/g++.dg/init/new24.C 2007-08-21 08:19:22.000000000 +0200
@@ -0,0 +1,18 @@
+// PR c++/33025
+// { dg-do compile }
+// { dg-options "-O2" }
+
+typedef __SIZE_TYPE__ size_t;
+inline void *operator new (size_t, void *p) throw () { return p; }
+extern "C" void abort ();
+
+int
+main()
+{
+ const unsigned num = 10;
+ unsigned *data = new unsigned[num];
+ unsigned *ptr = new (data) unsigned (num);
+ static unsigned data2[10];
+ unsigned *ptr2 = new (&data2[0]) unsigned (10);
+ return 0;
+}
Jakub