The following disables tail recursion optimization when fixed-point
types are involved as we cannot generate -1 for all fixed-point
types.
PR tree-optimization/119532
* tree-tailcall.cc (process_assignment): FAIL for fixed-point
typed functions.
* gcc.dg/torture/pr119532.c: New testcase.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target fixed_point } */
+
+extern _Fract sinuhk_deg (unsigned short _Accum);
+
+_Fract cosuhk_deg (unsigned short _Accum deg)
+{
+ unsigned short _Accum _90_deg = 90uhk;
+ __asm ("" : "+r" (_90_deg));
+
+ return deg <= _90_deg
+ ? sinuhk_deg (_90_deg - deg)
+ : -sinuhk_deg (deg - _90_deg);
+}
if (FLOAT_TYPE_P (TREE_TYPE (DECL_RESULT (current_function_decl))))
return FAIL;
+ /* We at least cannot build -1 for all fixed point types. */
+ if (FIXED_POINT_TYPE_P (TREE_TYPE (DECL_RESULT (current_function_decl))))
+ return FAIL;
+
if (rhs_class == GIMPLE_UNARY_RHS
&& op0 == *ass_var)
;