Evening, Arsen Arsenović <ar...@aarsen.me> writes:
> [[PGP Signed Part:Good signature from 52C294301EA2C493 Arsen Arsenović > <ar...@gcc.gnu.org> (trust ultimate) created at 2024-08-28T23:00:44+0200 > using EDDSA]] > Hi, > > Arsen Arsenović <ar...@aarsen.me> writes: > >>> The && should not be left of the =; if the initializer needs to span >>> multiple >>> lines, it's usually best to wrap it in (). >> >> Okay - done. > > [...] > >>>> + foo::operator delete (new (123, true) foo, 123, true); >>>> + foo::operator delete[] (new (123, true) foo[123], 123, true); >>> >>> Instead of passing the result of a new-expression directly to operator >>> delete, >>> you should also call operator new directly. >>> >>>> + foo::operator delete (new (123, true) foo[123], 123, true); >>>> + // { dg-warning "Wmismatched-new-delete" "" { target *-*-* } {.-1} } >>>> + // { dg-note "returned from" "" { target *-*-* } {.-2} } >>>> + foo::operator delete[] (new (123, true) foo, 123, true); >>> >>> Likewise. >> >> Ah, good point - adjusted. >> >> Here are the changes to v1 I've made as well as the full patch below >> them. Does this look OK? >> >> --8<---------------cut here---------------start------------->8--- >> modified gcc/gimple-ssa-warn-access.cc >> @@ -1776,9 +1776,9 @@ new_delete_mismatch_p (tree new_decl, tree delete_decl) >> return dc; >> }; >> >> - bool mismatch = ndc && ddc >> - && new_delete_mismatch_p (*strip_dc_template (ndc), >> - *strip_dc_template (ddc)); >> + bool mismatch = (ndc && ddc >> + && new_delete_mismatch_p (*strip_dc_template (ndc), >> + *strip_dc_template (ddc))); >> free (np); >> free (dp); >> return mismatch; >> modified gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-9.C >> @@ -35,13 +35,13 @@ f () >> // { dg-warning "Wmismatched-new-delete" "" { target *-*-* } {.-1} } >> // { dg-note "returned from" "" { target *-*-* } {.-2} } >> >> - foo::operator delete (new (123, true) foo, 123, true); >> - foo::operator delete[] (new (123, true) foo[123], 123, true); >> + foo::operator delete (foo::operator new (1, 123, true), 123, true); >> + foo::operator delete[] (foo::operator new[] (123, 123, true), 123, true); >> >> - foo::operator delete (new (123, true) foo[123], 123, true); >> + foo::operator delete (foo::operator new[] (123, 123, true), 123, true); >> // { dg-warning "Wmismatched-new-delete" "" { target *-*-* } {.-1} } >> // { dg-note "returned from" "" { target *-*-* } {.-2} } >> - foo::operator delete[] (new (123, true) foo, 123, true); >> + foo::operator delete[] (foo::operator new (1, 123, true), 123, true); >> // { dg-warning "Wmismatched-new-delete" "" { target *-*-* } {.-1} } >> // { dg-note "returned from" "" { target *-*-* } {.-2} } >> } >> --8<---------------cut here---------------end--------------->8--- Gentle ping again. Full patch: https://inbox.sourceware.org/gcc-patches/86y14ptvdi....@aarsen.me/ TIA, have a lovely evening. -- Arsen Arsenović
signature.asc
Description: PGP signature