public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] cp: Fix null pointer check for delete[]
@ 2022-03-14 10:35 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2022-03-14 10:35 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:2d8563f71110a9dfe2d177180178e98e2b5598c7

commit 2d8563f71110a9dfe2d177180178e98e2b5598c7
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Mon Feb 7 09:33:40 2022 +0000

    cp: Fix null pointer check for delete[]
    
    We were trying to compare capabilities, we should be comparing just the
    address values.
    
    gcc/cp/ChangeLog:
    
            * init.c (build_vec_delete_1): Compare address values when
            performing null pointer check.

Diff:
---
 gcc/cp/init.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 872c23453fd..adfb772ef44 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -4110,8 +4110,10 @@ build_vec_delete_1 (location_t loc, tree base, tree maxindex, tree type,
     body = integer_zero_node;
 
   /* Outermost wrapper: If pointer is null, punt.  */
-  tree cond = build2_loc (loc, NE_EXPR, boolean_type_node, base,
-			  fold_convert (TREE_TYPE (base), nullptr_node));
+  tree cond = build2_loc (loc, NE_EXPR, boolean_type_node,
+			  drop_capability (base),
+			  fold_convert (noncapability_type (TREE_TYPE (base)),
+					nullptr_node));
   /* This is a compiler generated comparison, don't emit
      e.g. -Wnonnull-compare warning for it.  */
   TREE_NO_WARNING (cond) = 1;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-14 10:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-14 10:35 [gcc(refs/vendors/ARM/heads/morello)] cp: Fix null pointer check for delete[] Matthew Malcomson

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