On Thu, 24 Aug 2017, Aldy Hernandez wrote:

As discussed in the PR...

CCP is passing a precision of 0 to get_nonzero_bits for complex
numbers.  With my last wide_int sign extension patch, the sign
extension of -1 with a precision of 0 returns 0, whereas it previously
was preturning all ones.  The attached patch calls element_precision,
to avoid getting a precision of 0.

So if we call get_nonzero_bits on a complex number, we get -1 with the precision of the real part? Not sure that's very meaningful :-/ What do the callers (with complex_type) look like, do they check if this returns -1 and give up in that case?

+  /* Use element_precision instead of TYPE_PRECISION so complex and
+     vector types get a non-zero precision.  */

IIRC, on vectors, TYPE_PRECISION gives the number of elements. Still, better not rely on that indeed.

+  unsigned int precision = element_precision (TREE_TYPE (name));

TREE_TYPE is not necessary there (it doesn't hurt though).

--
Marc Glisse

Reply via email to