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 r11-5705] Fix PR middle-end/98082 Date: Thu, 3 Dec 2020 14:56:42 +0000 (GMT) [thread overview] Message-ID: <20201203145642.E2EEF3851C23@sourceware.org> (raw) https://gcc.gnu.org/g:5d103763b9bc6a998dd4a453861663b229d7a24a commit r11-5705-g5d103763b9bc6a998dd4a453861663b229d7a24a Author: Eric Botcazou <ebotcazou@adacore.com> Date: Thu Dec 3 15:52:15 2020 +0100 Fix PR middle-end/98082 this fixes an ICE introduced by the fix for PR middle-end/97078 where use_register_for_decl was changed to return true at -O0 for a parameter of a thunk. It turns out that we need to do the same for a result in this case. gcc/ChangeLog: PR middle-end/98082 * function.c (use_register_for_decl): Also return true for a result if cfun->tail_call_marked is true. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/pr98082.C: New test. Diff: --- gcc/function.c | 6 ++++-- gcc/testsuite/g++.dg/cpp2a/pr98082.C | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/gcc/function.c b/gcc/function.c index 59fd72b0e82..af9618e18df 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -2206,13 +2206,15 @@ use_register_for_decl (const_tree decl) /* Otherwise, if RESULT_DECL is DECL_BY_REFERENCE, it will take the function_result_decl's assignment. Since it's a pointer, we can short-circuit a number of the tests below, and we must - duplicat e them because we don't have the - function_result_decl to test. */ + duplicate them because we don't have the function_result_decl + to test. */ if (!targetm.calls.allocate_stack_slots_for_args ()) return true; /* We don't set DECL_IGNORED_P for the function_result_decl. */ if (optimize) return true; + if (cfun->tail_call_marked) + return true; /* We don't set DECL_REGISTER for the function_result_decl. */ return false; } diff --git a/gcc/testsuite/g++.dg/cpp2a/pr98082.C b/gcc/testsuite/g++.dg/cpp2a/pr98082.C new file mode 100644 index 00000000000..b2caacb55df --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/pr98082.C @@ -0,0 +1,14 @@ +/* PR middle-end/98082 */ +/* Reported by Martin Liska <marxin@gcc.gnu.org> */ + +/* { dg-do compile { target c++20 } } */ +/* { dg-options "-fipa-icf" } */ + +class GoodIter { +public: + GoodIter(); + GoodIter(GoodIter &); +}; + +GoodIter operator-(int, GoodIter) { return GoodIter(); } +GoodIter operator+(int, GoodIter) { return GoodIter(); }
reply other threads:[~2020-12-03 14:56 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=20201203145642.E2EEF3851C23@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).