https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85164
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to rsand...@gcc.gnu.org from comment #6) Thanks for handling this. > > template<unsigned int N, typename Ca> > > inline POLY_BINARY_COEFF (Ca, Ca) > > known_alignment (const poly_int_pod<N, Ca> &a) > > { > > typedef POLY_BINARY_COEFF (Ca, Ca) C; > > C r = a.coeffs[0]; > > for (unsigned int i = 1; i < N; ++i) > > r |= a.coeffs[i]; > > return r & -r; > > } > > > > The poly_int* stuff makes this much harder to fix, it is unclear if there is > > some way to get the unsigned type for the C type and use that as r & -(Cuns) > > r; > > to avoid the UB, and there is no poly_uint_rtx_p or something to request > > poly_uint64 from the rtx. Richard? > > Changing: > > (unsigned HOST_WIDE_INT) known_alignment (const_op0) > > to: > > known_alignment (poly_uint64 (const_op0)) > > should work. That will handle this specific case, I was just hoping that for known_alignment we could fix all the cases that could be called on poly_int64. For HOST_WIDE_INT_MIN, do we want known_alignment to return HOST_WIDE_INT_MIN or something different? It is maximum alignment admittedly only if we are treating the result as unsigned. Or shall we in known_alignment assert or compile time assert that it is unsigned and fix all the users?