diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2020-12-03 15:52:15 +0100 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2020-12-03 15:56:33 +0100 |
commit | 5d103763b9bc6a998dd4a453861663b229d7a24a (patch) | |
tree | 7f4a3acf42b2db48df4669313ff31cc03e5e1b49 /gcc/function.c | |
parent | 896048cf43d5eb21ab7c16553bb9d13b0f890b81 (diff) | |
download | gcc-5d103763b9bc6a998dd4a453861663b229d7a24a.zip gcc-5d103763b9bc6a998dd4a453861663b229d7a24a.tar.gz gcc-5d103763b9bc6a998dd4a453861663b229d7a24a.tar.bz2 |
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.
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/function.c b/gcc/function.c index 59fd72b..af9618e 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; } |