https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67442
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- That is, tree wide_int_to_tree (tree type, const wide_int_ref &pcst) { ... unsigned int prec = TYPE_PRECISION (type); signop sgn = TYPE_SIGN (type); ... wide_int cst = wide_int::from (pcst, prec, sgn); is according to its docs "The value is extended from its precision according to the sign of the type", but that isn't what anyone would expect. IIRC the wide_int_ref doesn't have a "sign", so we can't do the correct thing. So IMHO we should require pcst.get_precision () == prec and maybe offer an overload tree wide_int_to_tree (tree type, const wide_int_ref &pcst, signop sgn); that can specify the sign of pcst (or maybe require that always...).