This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] PR c++/35878
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- Cc: Jason Merrill <jason at redhat dot com>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 21 Mar 2017 07:48:17 +0100
- Subject: Re: [C++ PATCH] PR c++/35878
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jakub at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DDF4681233
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DDF4681233
- References: <CAFk2RUbPyzFx-rozoCm5PRJ-fWW-VS4kF7o_0c7tVLcDCNpQsg@mail.gmail.com> <CADzB+2=1z-6GL1PNO+cST=KtrrLSmeGokjEzmQ89iu7fjh8Vcg@mail.gmail.com> <CAFk2RUaDq4ga1D-LcdOJzcn+UbF8m-YzeJRYpo3rULKtS=9qRw@mail.gmail.com> <alpine.DEB.2.20.1703210029490.1979@stedding.saclay.inria.fr> <CADzB+2nKVsz4KpwMkvEqkSAiHNCs9x33u69Jq=Hs4K1jbhEK3Q@mail.gmail.com> <CAFk2RUb84L5=Q9_DKnB9jSKw1+=FishTeaWU9x+s_9WChZoccQ@mail.gmail.com> <CAFk2RUYnt6ALnk8ZPEAaOjQDJROKqrs_Wfb=f72Hd958K0gQ5w@mail.gmail.com> <CAFk2RUa7972Ob+jkO9OKeXixyFsokgmTa9BBWubWwM26Z6bj+A@mail.gmail.com> <CAFk2RUbHhy7Qrjn+bPunYTvB_QOzDrrQx2_ZdbqM5H81qEHprA@mail.gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
On Tue, Mar 21, 2017 at 03:21:11AM +0200, Ville Voutilainen wrote:
Formatting etc. nits:
> 2017-03-21 Ville Voutilainen <ville.voutilainen@gmail.com>
>
> gcc/
>
> PR c++/35878
This should go into gcc/cp/ ChangeLog
> * cp/init.c (std_placement_new_fn_p): New.
without cp/ here.
> (build_new_1): Call it.
> +/* Determine whether an allocation function is a namespace-scope
> + non-replaceable placement new function. See DR 1748.
> + TODO: Enable in all standard modes. */
> +static bool std_placement_new_fn_p (tree alloc_fn)
static bool
std_placement_new_fn_p (tree alloc_fn)
> @@ -3171,7 +3186,8 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
> So check for a null exception spec on the op new we just called. */
>
> nothrow = TYPE_NOTHROW_P (TREE_TYPE (alloc_fn));
> - check_new = (flag_check_new || nothrow);
> + check_new = flag_check_new
> + || (nothrow && !std_placement_new_fn_p (alloc_fn));
This should be either:
check_new
= flag_check_new || (nothrow && !std_placement_new_fn_p (alloc_fn));
or
check_new = (flag_check_new
|| (nothrow && !std_placement_new_fn_p (alloc_fn)));
i.e. || should not be when on next line at different column than
flag_check_new (and the ()s to make emacs happy).
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/init/pr35878_1.C
> @@ -0,0 +1,21 @@
> +// { dg-options "-O2 --std=gnu++11" }
-O2 -std=gnu++11 is enough, no need for double dash --std=gnu++11.
> +// { dg-do compile }
> +// { dg-final { scan-assembler "test.*%rdi, %rdi" { target i?86-*-* x86_64-*-* } } }
This will surely fail on 32-bit or with -mx32. So either you need to use it
on { target { { i?86-*-* x86_64-*-* } && lp64 } } only, or perhaps instead
of scanning assembler add -fdump-tree-optimized to dg-options and
scan-tree-dump for the NULL? pointer comparison there.
Jakub