public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR c++/68831 (superfluous -Waddress warning for C++ delete)
@ 2015-12-10 23:55 Patrick Palka
  2015-12-17 17:48 ` Patrick Palka
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Palka @ 2015-12-10 23:55 UTC (permalink / raw)
  To: gcc-patches; +Cc: jason, Patrick Palka

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.
---
 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix PR c++/68831 (superfluous -Waddress warning for C++ delete)
  2015-12-10 23:55 [PATCH] Fix PR c++/68831 (superfluous -Waddress warning for C++ delete) Patrick Palka
@ 2015-12-17 17:48 ` Patrick Palka
  2015-12-17 19:34   ` Jason Merrill
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Palka @ 2015-12-17 17:48 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jason Merrill, Patrick Palka

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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix PR c++/68831 (superfluous -Waddress warning for C++ delete)
  2015-12-17 17:48 ` Patrick Palka
@ 2015-12-17 19:34   ` Jason Merrill
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Merrill @ 2015-12-17 19:34 UTC (permalink / raw)
  To: Patrick Palka, GCC Patches

OK.

Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-17 19:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-10 23:55 [PATCH] Fix PR c++/68831 (superfluous -Waddress warning for C++ delete) Patrick Palka
2015-12-17 17:48 ` Patrick Palka
2015-12-17 19:34   ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).