I sent email about this a few months ago (I can't find it since I'm having a problem getting a browser to work on gcc.gnu.org) and thought I'd raise it again since it would be good to get this into 4.1
Currently, tail call detected is almost completely disabled for Ada due to confusion as to which conversions are stripped off. It used to be that STRIP_USELESS_TYPE_CONVERSION used to strip exactly those conversions that the types_compatible_p langhook said were compatible. But that's no longer true. Because of that, find_tail_call says most calls in Ada aren't eligable. I propose the following patch and also propose doing it in all similar uses of a direct call of the lang hook in the optimizer since I think all have the same problem. But I've only tested the patch below so far. Comments? *** tree-tailcall.c (revision 107176) --- tree-tailcall.c (working copy) *************** find_tail_calls (basic_block bb, struct *** 447,452 **** we emitted a suitable type conversion statement. */ if (!is_gimple_reg_type (TREE_TYPE (param)) ! || !lang_hooks.types_compatible_p (TREE_TYPE (param), ! TREE_TYPE (arg))) break; --- 447,452 ---- we emitted a suitable type conversion statement. */ if (!is_gimple_reg_type (TREE_TYPE (param)) ! || !tree_ssa_useless_type_conversion_1 (TREE_TYPE (param), ! TREE_TYPE (arg))) break;