Message ID | alpine.LSU.2.20.1703011306070.30051@zhemvz.fhfr.qr |
---|---|
State | New |
Headers | show |
On Wed, Mar 01, 2017 at 01:08:58PM +0100, Richard Biener wrote: > > In debugging a -Wuninitialized issue from ipa-cp.c which does > > vr.min = vr.max = wi::zero (INT_TYPE_SIZE); Note maybe it would be faster to: vr.min = wi::zero (INT_TYPE_SIZE); vr.max = wi::zero (INT_TYPE_SIZE); That doesn't mean your wide-int.h change isn't useful. Jakub
On Wed, 1 Mar 2017, Jakub Jelinek wrote: > On Wed, Mar 01, 2017 at 01:08:58PM +0100, Richard Biener wrote: > > > > In debugging a -Wuninitialized issue from ipa-cp.c which does > > > > vr.min = vr.max = wi::zero (INT_TYPE_SIZE); > > Note maybe it would be faster to: > vr.min = wi::zero (INT_TYPE_SIZE); > vr.max = wi::zero (INT_TYPE_SIZE); > > That doesn't mean your wide-int.h change isn't useful. Note that rewriting like above doesn't fix the warning. The issue is from generic_wide_int<storage>& generic_wide_int<T>::operator=(const T&) [with T = wi::hwi_with_prec; storage = wide_int_storage] (struct generic_wide_int * const this, const struct hwi_with_prec & x) { struct wide_int_storage D.47458; struct generic_wide_int & D.52104; wide_int_storage::wide_int_storage<wi::hwi_with_prec> (&D.47458, x); try { this->D.16244 = D.47458; where wide_int_storage::wide_int_storage<wi::hwi_with_prec> (&D.47458, x) doesn't initialize all of wide_int_storage (but only up to len). Richard.
Index: gcc/wide-int.h =================================================================== --- gcc/wide-int.h (revision 245803) +++ gcc/wide-int.h (working copy) @@ -1019,6 +1019,9 @@ public: HOST_WIDE_INT *write_val (); void set_len (unsigned int, bool = false); + template <typename T> + wide_int_storage &operator = (const T &); + static wide_int from (const wide_int_ref &, unsigned int, signop); static wide_int from_array (const HOST_WIDE_INT *, unsigned int, unsigned int, bool = true); @@ -1058,6 +1061,18 @@ inline wide_int_storage::wide_int_storag wi::copy (*this, xi); } +template <typename T> +inline wide_int_storage& +wide_int_storage::operator = (const T &x) +{ + { STATIC_ASSERT (!wi::int_traits<T>::host_dependent_precision); } + { STATIC_ASSERT (wi::int_traits<T>::precision_type != wi::CONST_PRECISION); } + WIDE_INT_REF_FOR (T) xi (x); + precision = xi.precision; + wi::copy (*this, xi); + return *this; +} + inline unsigned int wide_int_storage::get_precision () const {