On Thu, Mar 27, 2025 at 09:28:31PM +0100, Uros Bizjak wrote:
> plus_constant expects integer as its third argument, not rtx.
> 
> gcc/ChangeLog:
> 
>     * config/i386/i386.cc (ix86_redzone_clobber): Use integer, not rtx
>     as the third argument of plus_constant.

Oops, thanks for catching this.

And guess we should improve the poly-int.h ctors so that it rejects mistakes
like this, rather than doing something really weird.

If I read it right, I think it was just casting the rtx (i.e. a pointer)
to HOST_WIDE_INT:

void poly_int<1, long int>::poly_int<rtx_def*> (struct poly_int * const this, 
struct rtx_def * const & cs#0)
{
  struct poly_int_full D.324089;
              
  [../../gcc/poly-int.h:455:1] [../../gcc/poly-int.h:455:1] *this = 
{CLOBBER(bob)};
  [../../gcc/poly-int.h:457:16] {
    [../../gcc/poly-int.h:457:13] poly_int<1, long int>::poly_int<rtx_def*> 
(this, D.324089, cs#0);
  }
}
                  
                  
void poly_int<1, long int>::poly_int<rtx_def*> (struct poly_int * const this, 
struct poly_int_full D.289987, struct rtx_def * const & cs#0)
{
  [../../gcc/poly-int.h:470:1] [../../gcc/poly-int.h:470:1] *this = 
{CLOBBER(bob)};
  [../../gcc/poly-int.h:472:49] {
    [../../gcc/poly-int.h:471:5] _1 = [../../gcc/poly-int.h:471:5] *cs#0;
    [../../gcc/poly-int.h:471:5] _2 = (long int) _1;
    [../../gcc/poly-int.h:471:5] [../../gcc/poly-int.h:471:5] this->coeffs[0] = 
_2;
  }
}

/* Initialize with cs... directly, casting where necessary.  */
template<unsigned int N, typename C>
template<typename ...Cs>
inline constexpr
poly_int<N, C>::poly_int (poly_int_full, const Cs &... cs)
  : coeffs { (typename poly_coeff_traits<C>::
              template init_cast<Cs>::type (cs))... } {}

Wonder if we shouldn't static_assert that Cs is not a pointer
somewhere or something like that (or floating point type).
I bet the intent is to support there integral types and the various
wide_int flavors.

        Jakub

Reply via email to