public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-1084] Restore bootstrap on ARM Date: Tue, 14 Jun 2022 10:49:34 +0000 (GMT) [thread overview] Message-ID: <20220614104934.E7EFF387475A@sourceware.org> (raw) https://gcc.gnu.org/g:be6676286a0fad2d7fdb6a258befe9deb826690e commit r13-1084-gbe6676286a0fad2d7fdb6a258befe9deb826690e Author: Eric Botcazou <ebotcazou@adacore.com> Date: Tue Jun 14 12:28:24 2022 +0200 Restore bootstrap on ARM The -Wuse-after-free warning is explicitly disabled for destructors on ARM because of the special ABI and the previous change to the warning machinery uncovered another case where the warning data would be incorrectly erased. gcc/ * warning-control.cc (copy_warning) [generic version]: Do not erase the warning data of the destination location when the no-warning bit is not set on the source. (copy_warning) [tree version]: Return early if TO is equal to FROM. (copy_warning) [gimple version]: Likewise. gcc/testsuite/ * g++.dg/warn/Wuse-after-free5.C: New test. Diff: --- gcc/testsuite/g++.dg/warn/Wuse-after-free5.C | 15 +++++++++++++++ gcc/warning-control.cc | 8 ++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/g++.dg/warn/Wuse-after-free5.C b/gcc/testsuite/g++.dg/warn/Wuse-after-free5.C new file mode 100644 index 00000000000..794cbfc44e7 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wuse-after-free5.C @@ -0,0 +1,15 @@ +// Check the suppression of -Wuse-after-free for destructors on ARM +// { dg-do compile } +// { dg-options "-Wuse-after-free" } + +struct range_label { + virtual ~range_label(); +}; + +struct unpaired_bidi_rich_location { + struct custom_range_label : range_label {}; + unpaired_bidi_rich_location(int); + custom_range_label m_custom_label; +}; + +void maybe_warn_bidi_on_close() { unpaired_bidi_rich_location(0); } diff --git a/gcc/warning-control.cc b/gcc/warning-control.cc index 0cbb4f079fa..7e9e701cfbe 100644 --- a/gcc/warning-control.cc +++ b/gcc/warning-control.cc @@ -191,7 +191,7 @@ void copy_warning (ToType to, FromType from) { const location_t to_loc = get_location (to); - bool supp = get_no_warning_bit (from); + const bool supp = get_no_warning_bit (from); nowarn_spec_t *from_spec = get_nowarn_spec (from); if (RESERVED_LOCATION_P (to_loc)) @@ -209,7 +209,7 @@ void copy_warning (ToType to, FromType from) nowarn_spec_t tem = *from_spec; nowarn_map->put (to_loc, tem); } - else + else if (supp) { if (nowarn_map) nowarn_map->remove (to_loc); @@ -226,6 +226,8 @@ void copy_warning (ToType to, FromType from) void copy_warning (tree to, const_tree from) { + if (to == from) + return; copy_warning<tree, const_tree>(to, from); } @@ -250,5 +252,7 @@ copy_warning (gimple *to, const_tree from) void copy_warning (gimple *to, const gimple *from) { + if (to == from) + return; copy_warning<gimple *, const gimple *>(to, from); }
reply other threads:[~2022-06-14 10:49 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220614104934.E7EFF387475A@sourceware.org \ --to=ebotcazou@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).