This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR28268, ICE building vector const { 1, 1 }
Richard Guenther <rguenther@suse.de> writes:
> > This makes me uncomfortable. The number zero seems like a special
> > case which merits special handling. The number one does not. What
> > you are looking for is a function which returns the multiplicative
> > identity for TYPE. Currently you are getting it by calling
> > fold_convert (TYPE, integer_one_node). Suppose you write the
> > multiplicative identify function, and handle VECTOR_TYPE there, rather
> > than making the number one a special case in fold_convert?
> >
> > Otherwise I think you need to give some justification for why
> > fold_convert should not permit any constant for VECTOR_TYPE. And it's
> > hard to see what that justification should be.
>
> My reasoning was that as zero (identity for addition), one is a special
> number (identity for multiplication). There's one other special number
> that one could add, -1, which represents a "sign", but that stretches
> the argument a bit.
The number zero is special for several reasons. In particular, we
probably use it when clearing memory.
The number one does not seem to me to have the same properties.
> The other fix I was thinking about is simply punting on VECTOR_TYPE
> arguments completely for the optimizations in fold_plusminus_mult_expr.
Sure, that is the easy way.
Ian