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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
> (In reply to Jakub Jelinek from comment #2)
> > To me this looks like a bug in gimple-fold.cc.
> > The r12-6924-gc2b610e7c6c89fd4 simplifies
> > _5 = 1 / c.0_4;
> > into
> > _5 = c.0_4 == 1;
> 
> No this is not valid gimple as the comparisons always return a boolean type.
> There needs to be a cast added.

I don't think we ever say that, nor we enforce that.
It is true that we don't fold
  _Bool _1;
  int _4;

  <bb 2> :
  _1 = a_2(D) == b_3(D);
  _4 = (int) _1;
  return _4;
to just
  _4 = a_2(D) == b_3(D);
  return _4;
though.
And it is true that e.g. truth_valued_p would misbehave if the
comparison/truth_* result is precision 1 signed integer (unless truth valued is
defined as 0 or non-zero rather than 0 and 1).
Certainly e.g. in Fortran EQ_EXPR etc. result doesn't need to be
boolean_type_node, can be also any of the logical(kind=8) etc. types.

Reply via email to