public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-5705] Fix PR middle-end/98082
@ 2020-12-03 14:56 Eric Botcazou
0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2020-12-03 14:56 UTC (permalink / raw)
To: gcc-cvs
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(); }
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-12-03 14:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 14:56 [gcc r11-5705] Fix PR middle-end/98082 Eric Botcazou
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).