From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
Richard Biener <rguenther@suse.de>
Subject: [PATCH] Restore input_location after recursive expand_call_inline
Date: Mon, 4 Jan 2021 21:12:43 +0100 [thread overview]
Message-ID: <AM0PR0602MB3410D0C853878A494D56E5D5E4D20@AM0PR0602MB3410.eurprd06.prod.outlook.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 466 bytes --]
Hi,
I spotted a place where input_location is clobbered accidentally.
That is in a recursive call to expand_call_inline. The input_location
is usually restored by goto egress in this function.
Additionally the return value of the recursive expand call is thrown
away, which does not look like a good idea.
Although this causes no problems ATM, I wanted to fix it anyway.
Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?
Thanks
Bernd.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Restore-input_location-after-recursive-expand_call_i.patch --]
[-- Type: text/x-patch; name="0001-Restore-input_location-after-recursive-expand_call_i.patch", Size: 1158 bytes --]
From 88b963bba7b32972abf0ea44a01c03d643d7c6ca Mon Sep 17 00:00:00 2001
From: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date: Mon, 4 Jan 2021 11:35:31 +0100
Subject: [PATCH] Restore input_location after recursive expand_call_inline
This is just a precautionary fix.
2021-01-04 Bernd Edlinger <bernd.edlinger@hotmail.de>
* tree-inline.c (expand_call_inline): Restore input_location.
Return result from recursive call.
---
gcc/tree-inline.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 360b85f..9f7d914 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4840,9 +4840,9 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id,
gimple_call_set_fndecl (stmt, edge->callee->decl);
update_stmt (stmt);
id->src_node->remove ();
- expand_call_inline (bb, stmt, id, to_purge);
+ successfully_inlined = expand_call_inline (bb, stmt, id, to_purge);
maybe_remove_unused_call_args (cfun, stmt);
- return true;
+ goto egress;
}
fn = cg_edge->callee->decl;
cg_edge->callee->get_untransformed_body ();
--
1.9.1
next reply other threads:[~2021-01-04 20:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-04 20:12 Bernd Edlinger [this message]
2021-01-04 21:23 ` Jeff Law
2021-01-05 6:44 ` Bernd Edlinger
2021-01-05 8:05 ` Richard Biener
2021-01-05 16:51 ` Jeff Law
2021-01-05 17:36 ` Bernd Edlinger
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=AM0PR0602MB3410D0C853878A494D56E5D5E4D20@AM0PR0602MB3410.eurprd06.prod.outlook.com \
--to=bernd.edlinger@hotmail.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
/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: link
Be 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).