https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105263

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

5336      /* Recurse on the LHS of the binary operator, which is guaranteed to
5337         be the non-leaf side.  */
5338      tree new_rhs1
5339        = rewrite_expr_tree (SSA_NAME_DEF_STMT (rhs1), rhs_code, opindex +
1, ops,
5340                             changed || oe->op != rhs2 || next_changed,
5341                             false);

but in this case it's the leaf side...

(gdb) p debug_gimple_stmt (stmt)
u_3 = u_2(D) * u_2(D);

(gdb) p debug_generic_expr (ops.m_vec->m_vecdata[0]->op)
u_2(D)
$11 = void
(gdb) p debug_generic_expr (ops.m_vec->m_vecdata[1]->op)
u_2(D)
$12 = void
(gdb) p debug_generic_expr (ops.m_vec->m_vecdata[2]->op)
_5
$13 = void
(gdb) p debug_generic_expr (ops.m_vec->m_vecdata[3]->op)
{ -1.0e+0 }

U foo (U u)
{
  _Decimal64 _1;
  U _5;
  vector(1) _Decimal64 _6;

  <bb 2> [local count: 1073741824]:
  u_3 = u_2(D) * u_2(D);
  _1 = BIT_FIELD_REF <v(address-taken), 64, 64>;
  _5 = {_1};
  _6 = -_5;
  u_7 = u_3 * _6;
  <retval> = u_7;
  return <retval>;

so basically the multiplication by -1 trick to handle the negation
breaks the left associativity rewrite because we need to go too deep.

Tricky.

Supposedly we have to pop the -1 before rewriting the expression
but we fail.  We fail because build_minus_one_cst doesn't build something
real_minus_onep, in this case the VECTOR_CST part, recognizes.  And
that's because of

3156    bool
3157    real_minus_onep (const_tree expr)
...
3164          return real_equal (&TREE_REAL_CST (expr), &dconstm1)
3165                 && !(DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (expr))));

means we have to exclude _Decimal modes from this trick.

Reply via email to