public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/104213] [12 Regression] bogus use-after-free in virtual dtor with -ffat-lto-objects on ARM Date: Mon, 24 Jan 2022 21:19:06 +0000 [thread overview] Message-ID: <bug-104213-4-Ss3bHxdZOI@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-104213-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104213 --- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> --- I've tried diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 22d3dd1e2ad..c2a0f0c24e2 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -17319,6 +17319,7 @@ finish_constructor_body (void) DECL_RESULT (current_function_decl), val); /* Return the address of the object. */ exprstmt = build_stmt (input_location, RETURN_EXPR, val); + suppress_warning (exprstmt, OPT_Wuse_after_free); add_stmt (exprstmt); } } @@ -17412,6 +17413,7 @@ finish_destructor_body (void) DECL_RESULT (current_function_decl), val); /* Return the address of the object. */ exprstmt = build_stmt (input_location, RETURN_EXPR, val); + suppress_warning (exprstmt, OPT_Wuse_after_free); add_stmt (exprstmt); } } diff --git a/gcc/cp/optimize.cc b/gcc/cp/optimize.cc index 4ad3f1dc9aa..51393710526 100644 --- a/gcc/cp/optimize.cc +++ b/gcc/cp/optimize.cc @@ -168,6 +168,7 @@ build_delete_destructor_body (tree delete_dtor, tree complete_dtor) tree val = DECL_ARGUMENTS (delete_dtor); val = build2 (MODIFY_EXPR, TREE_TYPE (val), DECL_RESULT (delete_dtor), val); + suppress_warning (val, OPT_Wuse_after_free); add_stmt (build_stmt (0, RETURN_EXPR, val)); } } the last hunk should have done the trick but the suppress_warning bits don't survive gimplification, it seems.
next prev parent reply other threads:[~2022-01-24 21:19 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-01-24 19:13 [Bug c++/104213] New: " dtardon at redhat dot com 2022-01-24 19:14 ` [Bug c++/104213] " dtardon at redhat dot com 2022-01-24 19:17 ` [Bug c++/104213] [12 Regression] " pinskia at gcc dot gnu.org 2022-01-24 20:35 ` [Bug target/104213] " mpolacek at gcc dot gnu.org 2022-01-24 20:39 ` mpolacek at gcc dot gnu.org 2022-01-24 20:48 ` msebor at gcc dot gnu.org 2022-01-24 20:51 ` jakub at gcc dot gnu.org 2022-01-24 20:54 ` pinskia at gcc dot gnu.org 2022-01-24 21:02 ` jakub at gcc dot gnu.org 2022-01-24 21:19 ` mpolacek at gcc dot gnu.org [this message] 2022-01-24 21:22 ` pinskia at gcc dot gnu.org 2022-01-24 21:31 ` mpolacek at gcc dot gnu.org 2022-01-24 21:37 ` mpolacek at gcc dot gnu.org 2022-01-25 7:59 ` rguenth at gcc dot gnu.org 2022-01-25 20:12 ` mpolacek at gcc dot gnu.org 2022-01-25 23:09 ` mpolacek at gcc dot gnu.org 2022-01-26 17:22 ` cvs-commit at gcc dot gnu.org 2022-01-26 17:23 ` mpolacek at gcc dot gnu.org 2022-01-29 5:40 ` pinskia at gcc dot gnu.org
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=bug-104213-4-Ss3bHxdZOI@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).