On 6/15/21 4:58 AM, Christophe Lyon wrote:
Hi,

On Tue, 15 Jun 2021 at 00:58, Martin Sebor via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:

On 6/2/21 3:46 PM, Marek Polacek wrote:
On Wed, Jun 02, 2021 at 03:40:49PM -0600, Martin Sebor via Gcc-patches wrote:
+  if (!gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
+    {
+      /* See if this is a call to placement new.  */
+      if (!fn
+      || !DECL_IS_OPERATOR_NEW_P (fn)
+      || DECL_IS_REPLACEABLE_OPERATOR_NEW_P (fn))
+    return NULL_TREE;
+
+      tree fname = DECL_ASSEMBLER_NAME (fn);
+      const char *name = IDENTIFIER_POINTER (fname);
+      if (strcmp (name, "_ZnwmPv")       // ordinary form
+      && strcmp (name, "_ZnamPv"))   // array form
+    return NULL_TREE;

Not a review, but you can use id_equal here and simplify things.

Okay, done.


On arm the new test Wmismatched-new-delete-4.C fails:
/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-4.C: In function
'void nowarn_placement_new()':
/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-4.C:16:8: warning:
'void free(void*)' called on pointer returned from a mismatched
allocation function [-Wmismatched-new-delete]
/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-4.C:16:42: note:
returned from 'void* operator new(unsigned int, void*)'
/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-4.C: In function
'void nowarn_placement_array_new()':
/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-4.C:21:8: warning:
'void free(void*)' called on pointer returned from a mismatched
allocation function [-Wmismatched-new-delete]
/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-4.C:21:8: note:
returned from 'void* operator new [](unsigned int, void*)'
FAIL: g++.dg/warn/Wmismatched-new-delete-4.C  -std=gnu++98  (test for
bogus messages, line 16)
FAIL: g++.dg/warn/Wmismatched-new-delete-4.C  -std=gnu++98  (test for
bogus messages, line 21)
FAIL: g++.dg/warn/Wmismatched-new-delete-4.C  -std=gnu++98  (test for
warnings, line 29)
FAIL: g++.dg/warn/Wmismatched-new-delete-4.C  -std=gnu++98  (test for
warnings, line 36)


and Wstringop-overflow-7.C:
FAIL: g++.dg/warn/Wstringop-overflow-7.C  -std=gnu++98  (test for
warnings, line 23)
FAIL: g++.dg/warn/Wstringop-overflow-7.C  -std=gnu++98  (test for
warnings, line 40)
PASS: g++.dg/warn/Wstringop-overflow-7.C  -std=gnu++98 (test for excess errors)

(no warning emitted)

Can you  check?

I've pushed r12-1490 to adjust the code to check the mangling of
both size_t representations: unsigned int and unsigned long.

Martin

Reply via email to