This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR c++/68831 (superfluous -Waddress warning for C++ delete)
- From: Patrick Palka <patrick at parcs dot ath dot cx>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Jason Merrill <jason at redhat dot com>, Patrick Palka <patrick at parcs dot ath dot cx>
- Date: Thu, 17 Dec 2015 12:47:41 -0500
- Subject: Re: [PATCH] Fix PR c++/68831 (superfluous -Waddress warning for C++ delete)
- Authentication-results: sourceware.org; auth=none
- References: <1449791666-13298-1-git-send-email-patrick at parcs dot ath dot cx>
On Thu, Dec 10, 2015 at 6:54 PM, Patrick Palka <patrick@parcs.ath.cx> wrote:
> Is this OK to commit if bootstrap + regtest on x86_64 succeeds?
>
> gcc/cp/ChangeLog:
>
> PR c++/68831
> * init.c (build_delete): Use a warning sentinel to disable
> -Waddress warnings when building the conditional that tests
> if the operand is NULL.
>
> gcc/testsuite/ChangeLog:
>
> PR c++/68831
> * g++.dg/pr68831.C: New test.
Ping.
> ---
> gcc/cp/init.c | 1 +
> gcc/testsuite/g++.dg/pr68831.C | 10 ++++++++++
> 2 files changed, 11 insertions(+)
> create mode 100644 gcc/testsuite/g++.dg/pr68831.C
>
> diff --git a/gcc/cp/init.c b/gcc/cp/init.c
> index 5ecf9fb..2fffc61 100644
> --- a/gcc/cp/init.c
> +++ b/gcc/cp/init.c
> @@ -4439,6 +4439,7 @@ build_delete (tree otype, tree addr, special_function_kind auto_delete,
> else
> {
> /* Handle deleting a null pointer. */
> + warning_sentinel s (warn_address);
> ifexp = fold (cp_build_binary_op (input_location,
> NE_EXPR, addr, nullptr_node,
> complain));
> diff --git a/gcc/testsuite/g++.dg/pr68831.C b/gcc/testsuite/g++.dg/pr68831.C
> new file mode 100644
> index 0000000..8d32819
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/pr68831.C
> @@ -0,0 +1,10 @@
> +// PR c++/68831
> +// { dg-options "-Waddress" }
> +
> +class DenseMap {
> +public:
> + ~DenseMap();
> +};
> +extern const DenseMap &GCMap;
> +void foo() { delete &GCMap; }
> +
> --
> 2.6.4.491.gda30757.dirty
>