https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118430
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This patch fixes the error message but not the missed optimization/reason why
it is rejected:
```
diff --git a/gcc/tree-tailcall.cc b/gcc/tree-tailcall.cc
index d6d7eb4b47c..8e9fa0cca9f 100644
--- a/gcc/tree-tailcall.cc
+++ b/gcc/tree-tailcall.cc
@@ -833,7 +833,7 @@ find_tail_calls (basic_block bb, struct tailcall **ret,
bool only_musttail,
&& (ret_var != ass_var
&& !(is_empty_type (TREE_TYPE (ret_var)) && !ass_var)))
{
- maybe_error_musttail (call, _("call uses return slot"));
+ maybe_error_musttail (call, _("call and return value are different"));
return;
}
```
I am still trying to figure out the place to get the range.
To get the range from the call is simple as:
```
tree callee = gimple_call_fndecl (call);
if (callee
&& useless_type_conversion_p (TREE_TYPE (TREE_TYPE (callee)), type))
{
value_range val;
if (ipa_return_value_range (val, callee)
&& val.singleton_p ())
{
....
}
}
```
But I don't see where the place to put this.